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
After upgrading to Enzyme V3, we started observing that now we need explicit update after setState. I read the migration guide and somehow i didn't get sense this is expected and hence raising issue here, please correct me if my understanding is wrong.
In the test I am trying to do following, see in the setState callback I have to explicit update now to make test pass. Is this expected? I feel this is common scenario and enzyme should handle this.
let shallowWrapper = Enzyme.shallow(<ComponentA text="text" />);
shallowWrapper.setState({
isLoading: false
}, () => {
shallowWrapper.update();
// Assertion here
});
The text was updated successfully, but these errors were encountered:
Thanks @koba04 for raising PR to fix this issue, moving out assertion after setState will work, but its good to have support of callback without any explicit update. For now I updated my test, hoping it get fixed in next version of enzyme
After upgrading to Enzyme V3, we started observing that now we need explicit update after setState. I read the migration guide and somehow i didn't get sense this is expected and hence raising issue here, please correct me if my understanding is wrong.
Here is the sample component
In the test I am trying to do following, see in the setState callback I have to explicit update now to make test pass. Is this expected? I feel this is common scenario and enzyme should handle this.
The text was updated successfully, but these errors were encountered: