-
Notifications
You must be signed in to change notification settings - Fork 233
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
Asyncs utils: You called act(async () => ...) without await #825
Comments
Same issue here! The problem comes when using more than one awaited waitFor in the same |
We can fix the problem using the solution proposed on https://stackoverflow.com/questions/64952449/react-native-testing-act-without-await/69201830#69201830 The patch consists in add one previous preset and one post preset in order to save the original implementation and restore it after react-native preset is set. We do this and found that many tests started to fail (many), and in order to not debug each one, we change the patch to save the original implementation (in first preset) in
|
Thank you for your effort and investigation into this @tcank. |
Do you mean to change the content of restore-promise.js like this:
I found it really works! |
This is still happening. It only happens when I use more than one awaited waitFor in the same |
I came to this solution: // https://github.com/testing-library/react-hooks-testing-library/issues/825
const asyncAct = (fn: () => Promise<unknown>) =>
new Promise((resolve) => {
act(fn).then(resolve);
}); Using it instead of |
Hi!, Im starting to test my hooks (in a POC stage), I have a simple test that works but I get the following warning that I dont know how can it solved 🤔
this is my hook
and in my test file, Im trying to test that if the props change, the data will change too
Am I forgetting something in the test file?
Thanks!
The text was updated successfully, but these errors were encountered: