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
I'm familiar with this technique in sinon, and I find that verifying arguments at the call site often results in better tests than verifying them after execution.
In trying to replicate the patterns I've used in sinon, it wasn't clear from the README how to write the default failing function that handles the wrong-args case.
I include my implementation below in hopes that you include it or something similar in your README:
// A default implementation that failsconstwrongArgs=(...args: any[])=>{thrownewError(`Wrong args: ${JSON.stringify(args,null,2)}`);};when(fn).mockImplementation(wrongArgs).calledWith(correctArgs).mockReturnValue(expectedValue);
The text was updated successfully, but these errors were encountered:
I'm starting to hate the README actually, it's getting very busy and hard to find things.
Also I'm starting to think the default behavior needs to be a more explicit abstraction, like maybe rename itwhen(fn).defaultImplementation() vs what it is today.
Thanks for creating this!
I'm familiar with this technique in sinon, and I find that verifying arguments at the call site often results in better tests than verifying them after execution.
In trying to replicate the patterns I've used in sinon, it wasn't clear from the README how to write the default failing function that handles the wrong-args case.
I include my implementation below in hopes that you include it or something similar in your README:
The text was updated successfully, but these errors were encountered: