-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
setTimeout needed with enzyme 3.10.0 #2272
Comments
Using setTimeout like that is a race condition. The timing of your "ObservableModel" is not clear, but that is what everything depends on. |
@ljharb I forgot to include constructor in my example:
So basically whenever I need to show or hide this component, I'm calling for "errors.update('errorShow')" or "errors.update('errorHide')" and the code I have in componentDidMount() does the rest. I'm not really sure what changes there have been in 3.10.0 compared to earlier versions where test worked correctly but it feels that with 3.10.0 there's just not enough time for component to update itself before test is executed. |
Current behavior
I have component including following:
And following way to test this:
Expected behavior
Second test should work also with enzyme 3.10.0 but instead it says that "Expected 1 to be 0." Same test works with enzyme 3.7.0 - 3.9.0. Modifying test like this makes it also work with 3.10.0:
Your environment
API
Version
Adapter
The text was updated successfully, but these errors were encountered: