When mocking services in jest, given:
const someMethodMock = mockService.someMethod as jest.Mock;
beforeEach(() => {
jest.clearAllMocks()
})
Calling jest.clearAllMocks
does not work as expected. Instead, you have to write:
beforeEach(() => {
someMethodMock.mockReset()
})
This is a known issue with jest.