Put in order · JavaScript and TypeScript course · Module 11: Testing with Jest
Steps for Mocking an External Module
Arrange the steps for mocking an external module in the correct order:
Items to put in order
- Verify mock calls (expect...toHaveBeenCalled)
- Call jest.mock() with the module name
- Execute the tested function
- Configure return values (mockReturnValue)
- Import the module in the test file
You can check the correct answer by solving this task in the CodeWorlds game.