Testing · Junior · Question 38 of 78
What does mockClear() (or vi.clearAllMocks()) do?
- ✓Correct answer: Resets recorded calls and results but keeps the configured implementation
- 2Removes the mock and restores the original function
- 3Deletes the test file
Explanation
Without clearing, calls from the previous test leak into the next one and toHaveBeenCalledTimes gives wrong numbers.