-
Notifications
You must be signed in to change notification settings - Fork 0
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
Set up Jest/testing library for tests #81
Comments
Viicos
added a commit
that referenced
this issue
Dec 8, 2023
Viicos
added a commit
that referenced
this issue
Dec 12, 2023
Viicos
added a commit
that referenced
this issue
Dec 13, 2023
Move shared test utils to a common file Exclude files so that we don't have to ignore specific types files
Viicos
added a commit
that referenced
this issue
Dec 13, 2023
Viicos
added a commit
that referenced
this issue
Dec 13, 2023
Viicos
added a commit
that referenced
this issue
Dec 13, 2023
Move shared test utils to a common file Exclude files so that we don't have to ignore specific types files
sergei-maertens
added a commit
that referenced
this issue
Dec 14, 2023
sergei-maertens
added a commit
that referenced
this issue
Dec 14, 2023
Note that the components fetch available dropdown options asynchronously, which leads to act warnings typically because the state updates happen outside of the initial render and are thus unexpected. These useEffect-based things run despite there not being any explicit user interaction (which is automatically wrapped in act via @testing-library/user-event). Instead, we can set up the jest fake timers so that we can still assert the loading state before it resolves, perform the user interactions and use the async queries to assert the expected final state, without having any act warnings. To be fair I don't 100% understand how the timer advancing works, but the tests seem to work when putting assertions in that should not pass (the test fails as expected) and we can assert the in-between/loading states, without getting any act warnings, so I'll take it.
sergei-maertens
added a commit
that referenced
this issue
Dec 14, 2023
This should be more reliable and not depend on browser-specific race conditions/unpredictable interactions with jest/testing-library.
Merged
Completed via #82 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As an alternative to running (integration/unit) tests in Storybook, which is too flaky.
The text was updated successfully, but these errors were encountered: