You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know why I should call wrapper.update() here.
Enzyme effectively takes a snapshot of your UI after the initial mount and when you call various Enzyme methods (eg. wrapper.setProps(...)). If you do something which causes the UI outside of Enzyme, such as the act block here, you need to tell Enzyme that the output as changed and it should take a new snapshot that you can then query. This is what wrapper.update() does.
From experience working with developers on my team this aspect of Enzyme can be pretty confusing if you've not developed a good mental model of how it works. It would definitely improve the user experience if the need for this could be eliminated.
I have same issue here but in my case, I dont use any setTimeout magic to make Enzyme snapshot out of date. #2542
Seem that Enzyme's .setProps() does not make Enzyme sync the snapshot as expected. It still requires an additional .update() to be call.
Current behavior
SomeComponent.tsx
:SomeComponent.test.tsx
:If I don't call
wrapper.update()
method, the changed state will not reflect in the view.test result
Expected behavior
I don't know why I should call
wrapper.update()
here. As you can see, the state is changed, but the value of thevisible
prop is not changed.API
Version
Adapter
The text was updated successfully, but these errors were encountered: