This is my default mock.
const mockFetcher = jest.fn().mockImplementation(() => {
return {
get: jest
.fn()
.mockImplementation(() => Promise.resolve({ data: 'testData' })),
post: jest
.fn()
.mockImplementation(() => Promise.resolve({ data: 'testData' })),
};
});
Sometimes, I want to return a different value but after it, I want to reset my mock to default state. I use jest.resetAllMock() method. My problem is that reset gives it a value of jest.fn() only. And not a value of a function that contains get set functions.