-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
rerender
does not reset state
#1331
Comments
CC:@MatanBobi |
You want to call |
Adding to what @eps1lon wrote, regarding what you wrote here:
That's not a good mental model. |
@MatanBobi thank you for clarifying. @eps1lon Thank you for the response as well. Regarding our use case: describeFeature(feature, (f) => {
let viRender = renderWithProviders(<InventoryTab />, {
preloadedState,
})
f.AfterEachScenario(() => {
viRender.rerender();
})
f.Scenario(...); Are you implying that we should call a new |
@eps1lon @MatanBobi we are still having an issue with state idempotency. We found a nearly identical issue that has not been resolved on Stack Overflow. We could open a new issue, but all of the details are here so hoping to continue on this thread. |
@charlieforward9 I recommend opening a new issue with the use case you're experiencing. |
@testing-library/react
version: 14.3.1Relevant code or config:
Renderer Code
Test Code
What you did:
Called
rerender
after initial call torenderWithProviders
to test resetting redux state.renderWithProviders
is a custom wrapper to include redux storeWhat happened:
After calling
rerender
, the redux store still persists state from initial render call. The screenshot below shows that the screen rerenders appropriately, but the redux store does not reset.Reproduction:
https://github.com/Agriculture-Intelligence/react-test-library-redux-example/tree/master
Related to:
#218 (comment)
#950
testing-library/testing-library-docs#1156 ?
Problem description:
rerender
should reset the wrapper as well. Our understanding of rerender is that it should work similar to a browser refresh.Ultimately, we want to test our components using Gherkin syntax and reset the component for every scenario as such
This Gherkin syntax testing is not included in the reproduction to simplify the issue we are having, this testing style comes from https://github.com/amiceli/vitest-cucumber
Suggested solution:
The text was updated successfully, but these errors were encountered: