React act() warnings
Closed this issue · 6 comments
sapegin commented
See this in each RemotePizza_*.spec.js
test and have no idea where should I put act()
calls:
console.error node_modules/react-dom/cjs/react-dom.development.js:545
Warning: An update to RemotePizza inside a test was not wrapped in act(...).
When testing, code that causes React state updates should be wrapped into act(...):
act(() => {
/* fire events that update state */
});
/* assert on the output */
This ensures that you're testing the behavior the user would see in the browser. Learn more at https://fb.me/react-wrap-tests-with-act
in RemotePizza (created by WrapperComponent)
in WrapperComponent
montogeek commented
This one works but it throws a different error about the act
version`:
It works
https://codesandbox.io/s/enzyme-jest-example-z5eo0
sapegin commented
Hm, what did you change?
montogeek commented
Put everything inside the act
sapegin commented
Ufff ;-/
montogeek commented
Also made it async, check Hello.test.js