3 ms·
Mock functions are a really powerful tool. They let you test asynchronous functions in an entirely synchronous way. Because of that, Jest doesn't need to provid
by vjeux 12y ago
Mock functions are a really powerful tool. They let you test asynchronous functions in an entirely synchronous way. Because of that, Jest doesn't need to provide special support for asynchronous testing
http://facebook.github.io/jest/docs/tutorial.html#content http://facebook.github.io/jest/docs/tutorial.html#content
- couchand 12y agoThat might work for simple cases but I'd be worried that switching all your asynchronous calls to synchronous has the potential to introduce bugs that your tests would then miss. Testing asynchronous functions is hard for lots of reasons, and only one of them is that you have to wait for it to finish.