Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor frontend fixes to improve unit test reliability #38797

Merged
merged 1 commit into from Jan 29, 2021

Conversation

molly-moen
Copy link
Contributor

In our testing of the feasibility of upgrading to react-16.13 a few unit tests failed due to the new version being stricter about catching errors. These fixes will prevent some tests from failing when we upgrade.
The fixes are:

  • instead of using && to set a title field, use ternary and assign to undefined if the expression would have evaluated to false
  • only call .empty in unit tests on lists (was calling on a non-existent state variable and on 0 before)
  • check for the existence of an object before trying to get an element out of it (this caused occasional failures already).

Testing story

Tested these by running unit tests and verifying they still pass on our current react version, and will pass if we upgrade to > React 16.

Reviewer Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@molly-moen molly-moen merged commit 5be6417 into staging Jan 29, 2021
@molly-moen molly-moen deleted the molly/small-test-fixes branch January 29, 2021 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants