Closed
Description
🚀 Feature Proposal
A guide on basic mocking with jest using jest.mock
. The guide would be on the sidebar after "Timer mocks".
It would explain how to use jest.mock
properly, what the different parameters do and provide examples for using them.
Motivation
When I was a beginner I didn't understand how to use jest.mock
at all, particularly the second parameter of jest.mock
. This was even more fiddly because I use ES6 modules, giving the default export another "gotcha" when used in tests.
As this is quite an essential feature for unit testing I think a guide will be beneficial to many users.
Please let me know your thoughts. If it sounds good I can make a PR.