Description
Describe the feature you'd like:
wait
from asyncUtilities
is only called when the hooks updates, and can't be used to check on side-effects. As far as I know, this is different from the behaviour of the wait
exposed from @testing-library/dom
or the one of @testing-library/react-native
which to me was very confusing.
I have a hook that does some async work, then dispatches a redux action. I was doing a await wait(() => expect(store.dispatch).toHaveBeenCalled())
. My test never resolved, replacing the wait
from renderHook
to the one exported in @testing-library/react
made my test pass.
Suggested implementation:
I didn't look enough to the implementation of these two libraries' wait, but perhaps something similar could be made? I would be totally ok with contributing and opening such a PR if you're ok.
Teachability, Documentation, Adoption, Migration Strategy:
There shouldn't be any change of API, and this would not be a breaking change, so I guess this wouldn't be ok?