Hi guys, great library. I'd like to request a feature regarding spies. If using them, we most likely want to make sure that the spy is called exactly as expected by using calledWithExactly
. We also want to make sure this happens only a single time by using calledOnce
. Of course, this is possible right now. But I think it should be the default assertion (compared to partial matching) and therefore it would be great if boilerplate could be reduced by introducing a combined method like onceCalledWithExactly
or calledOnceWithExactly
. What do you think?
Using sinon-chai
, this ...
expect(mySpy).calledOnce.and.calledWithExactly(expectedValue);
could be replaced by this:
expect(mySpy).calledOnceWithExactly(expectedValue);
I'd like to second this request. Our team frequently uses both calledOnce
and calledWithExactly
and it would enforce best practices to consolidate them into one method.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
It's super surprising for me that there is no such method. I actually thought that calledWithExactly
asserts that there was just 1 call (so it's was really exactly called with this params and that's all). I am gonna work on this now.
FYI: it was just merged :)
Most helpful comment
FYI: it was just merged :)