Testing & QA Code Reorder Hard +35 XP
Mock Setup
Arrange Jest mock setup correctly.
Click lines in the correct order
Available lines4 left
Your order
Click lines above to build your solution.
Show answer and explanation
Answer: jest.mock("../email");
const { sendEmail } = require("../email");
registerUser("alice@test.com");
expect(sendEmail).toHaveBeenCalled();
Mock the module first, then import it, then call the function under test, then assert the mock was called.
Hint: jest.mock() must come before require().
What this challenge tests
Code Reorder in Testing & QA: jest, mocking.