DEV Community

Discussion on: The only 3 steps you need to mock an API call in Jest

Collapse
 
alanjereb profile image
Alan Jereb

To avoid mistakes and writing jest.resetAllMocks() after each test, you can use the following:

describe("My awesome test", () => {
    afterEach(() => {
       jest.resetAllMocks();
    });
    it("should do this and that", () => {
       ...
Enter fullscreen mode Exit fullscreen mode