score:5

Accepted answer

Yes that's perfectly safe. Similarly to setTimeout(callback, 0), promise callbacks are queued to run after the rest of the synchronous code. This ensures your assertions will run at the correct points in your program.

Small tip for unit testing - instead of calling c.instance().handleClick() I would call c.find('button').prop('onClick')(). Your component is the "unit" that you're testing and so you should try to avoid accessing internal methods / properties


Related Query

More Query from same tag