Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
distante opened this issue Dec 11, 2020 · 1 comment
Open

Comments

@distante
Copy link

distante commented Dec 11, 2020

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:

export function reset<T>(...mockedValues: T[]): void {
mockedValues.forEach(mockedValue => (mockedValue as any).__tsmockitoMocker.reset());
}

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
Copy link

This certainly seems like a mistake with the types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants