- Got some great advice from dev.to which has helped clear up my understanding of spies and mocks.
jest.mock() vs jest.spyOn() Looks like here you are using jest.mock() and jest.spyOn() here on the same function. Usually, these are used interchangeably, but not together.
Another good trick to properly type mock
and mockResolvedValue
. Simply cast to jest.Mock
like so:
(axios.get as jest.Mock).mockResolvedValue(fakeResp);