Reputation: 39
I'm trying to test my React Application with React Testing Library and Jest but I always have the following error.
An update to StoreProvider inside a test was not wrapped in act(...)
I tried many things like put act() function around my test but can't be able to remove the warning and get the correct result.
Here's a simplified project that demonstate the problem: https://codesandbox.io/s/adoring-haslett-6rq34?file=/src/PageContent.test.js
Thanks for your help.
Upvotes: 0
Views: 1650
Reputation: 39
Here's a working solution.
https://github.com/testing-library/react-testing-library/issues/641#event-3244842083
I have to waitFor an element
const { findByText } = render(<App />)
expect(await findByText('STATUS = 0')).toBeInTheDocument();
Upvotes: 2