I've got a typescript class EntityConfigurationMapper
, with a map
method. I'm mocking it in my Jest tests like this:
const mock = jest.fn<EntityConfigurationMapper>()
.mockImplementation(() => ({
map: (conf): Entity => {
return {...};
}
}));
const instance = new entityConfigurationMapperMock();
Then it gets used etc.
I want to check the calls, which should be like mock.calls[0][0]
etc. However, the mock.calls
is an empty array.
I've put a console in the mocked map
method, and it outputs as expected, so the mock is calling the mocked implementation, just not recording it the calls
array.
Any idea why calls
would be empty?