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

web: switch HUD tests to use react test-utils instead of enzyme #5707

Merged
merged 2 commits into from
Apr 19, 2022

Conversation

nicks
Copy link
Member

@nicks nicks commented Apr 19, 2022

Hello @lizzthabet,

Please review the following commits I made in branch nicks/reacttesting:

a729e85 (2022-04-19 14:31:46 -0400)
web: switch HUD tests to use react test-utils instead of enzyme

Code review reminders, by giving a LGTM you attest that:

  • Commits are adequately tested
  • Code is easy to understand and conforms to style guides
  • Incomplete code is marked with TODOs
  • Code is suitably instrumented with logging and metrics

@nicks nicks requested a review from lizzthabet April 19, 2022 18:39
@nicks
Copy link
Member Author

nicks commented Apr 19, 2022

react-testing-library doesn't have a good way to get the component instance, but this lower-level library does, so we'll just use that for tests that need it.

Copy link
Contributor

@lizzthabet lizzthabet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

const hud = root.find(HUD)
expect(hud.text()).toEqual(expect.stringContaining("Loading"))
let root = emptyHUD()
let rootTree = renderIntoDocument(root)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh! it looks like this may not return the tree. i'm seeing type errors locally and in ci.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed! tbh i don't know why react thinks this returns void

@nicks nicks merged commit 2045296 into master Apr 19, 2022
@nicks nicks deleted the nicks/reacttesting branch April 19, 2022 21:32
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.

2 participants