Skip to content

Commit

Permalink
Update ManualMocks.md
Browse files Browse the repository at this point in the history
A bit more explanation on the procedure of using and inviting manual mockups. There are both issues and SO questions coming from the confusion of how and when the mock should be called, and if it will be automatically called.
  • Loading branch information
mprinc authored May 4, 2021
1 parent ba84480 commit af51f17
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion website/versioned_docs/version-26.x/ManualMocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Manual mocks are used to stub out functionality with mock data. For example, ins

Manual mocks are defined by writing a module in a `__mocks__/` subdirectory immediately adjacent to the module. For example, to mock a module called `user` in the `models` directory, create a file called `user.js` and put it in the `models/__mocks__` directory. Note that the `__mocks__` folder is case-sensitive, so naming the directory `__MOCKS__` will break on some systems.

> When we require that module in our tests, explicitly calling `jest.mock('./moduleName')` is **required**.
> When we require that module in our tests (meaning we want to use the manual mock instead of the real implementation), explicitly calling `jest.mock('./moduleName')` is **required**.
## Mocking Node modules

Expand Down

0 comments on commit af51f17

Please sign in to comment.