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

Address new eslint issues in tests #865

Open
sprucely opened this issue Jun 2, 2023 · 0 comments
Open

Address new eslint issues in tests #865

sprucely opened this issue Jun 2, 2023 · 0 comments
Assignees

Comments

@sprucely
Copy link
Contributor

sprucely commented Jun 2, 2023

After CRA is upgraded to 5.0.1 (#862), there will be some new eslint warnings that will need some work.

  • Avoid wrapping Testing Library util calls in 'act'
    Rendering of react components shouldn't be wrapped in act call. Instead, wrap the subsequent code in waitFor from @testing-library/react, ie: await waitfor(() => { ... })

  • Avoid direct Node access. Prefer using the methods from Testing Library.
    Eliminate the usage of a manually created document and container element, and use the render function from @testing-library/react instead of react-dom

    Replace container.querySelector with equivalent getBy... functions on screen from @testing-library/react. There is no equivalent for css class selectors, so an alternative will need to be found for identifying those elements.

After those are addressed, I don't know if more issues will crop up. Eslint doesn't seem too keen on showing all classes of issues at once.

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

No branches or pull requests

2 participants