You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function underTest(myClassInstance) {
if (..something..) {
return;
}
myClassInstance.a();
}
it('does nothing on MyClass if something', () => {
// setup to trigger "something"-case
underTest(mockedMyClass);
td.verifyNoFurtherInvocations(mockedMyClass);
});
I could write a test that uses td.verify(..) with times:0 on each of the methods on MyClass, but that is not particularly semantic and it would also need to be updated whenever a new method was added to MyClass.
Disclaimer: I come from languages like C# and Java and I am new to nodejs, so it might be that I am simply doing something that makes no sense in this world.
The text was updated successfully, but these errors were encountered:
This is excluded by design, but if really needed you can work around it as you suggested above with the times: 0 option. For a related discussion on why this is not encouraged by the API, see: #170 (comment)
I often find it useful to be able to verify that no methods are called on a mocked class (in certain cases of course).
Consider the following case:
I could write a test that uses td.verify(..) with times:0 on each of the methods on MyClass, but that is not particularly semantic and it would also need to be updated whenever a new method was added to MyClass.
Disclaimer: I come from languages like C# and Java and I am new to nodejs, so it might be that I am simply doing something that makes no sense in this world.
The text was updated successfully, but these errors were encountered: