NagRock / ts-mockito

Mocking library for TypeScript
MIT License
974 stars 93 forks source link

reset(mock1, mock2) expects that mock1 and mock2 have the same type. #208

Open distante opened 3 years ago

distante commented 3 years ago

I am not sure if this is an error or a feature request, so I did not trusted my self to do a PR

The definition for reset is:

https://github.com/NagRock/ts-mockito/blob/6637048fdc72b676efcf210bc5be8d432c4ce1b1/src/ts-mockito.ts#L76-L79

That means, that we can just use multiple mocks if they have the same type. Is this the expected behavior? I thought the idea was to be able to do:

const mock1 = mock(MyWonderClass);
const mock2 = mock(ThisIsAnotherClass);

reset(mock1, mock2)

as workaround one can set the reset as any but this feels dirty

reset<any>(mock1, mock2)
fgblomqvist commented 1 year ago

This certainly seems like a mistake with the types.