-
-
Notifications
You must be signed in to change notification settings - Fork 768
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
Add Sinon.assert.calledOnceWithExactly #2006
Comments
* Clarify exactly how calledOnceWith* works ref discussions in #1971, #1686, #2006 Makes it clearer how these methods work. It was unclear to me whether these methods would return true if one of many calls had been made using these args (although that would have made it a duplicate of the `calledWith*` methods).
@brandonau24 I believe you are talking about something else. @dpmott is addressing the feature disparity between the assertions available on the spies and the standalone assertions that can be invoked on spies. Furthermore, everything a spy can do, a stub can do as well: a stub simply extends the spy api. So all the spy assertions are already available on a stub, so you can always use a stub in place of a spy - it's more of a semantical discussion whether or not to explicitly use a spy. @dpmott I'd try to make the assertion message even clearer (ref 88a7150 and the whole discussion in #1971 (comment)). + What about "expected %n to be called once and with the exact arguments %D"?
- What about "expected %n to be called once with exact arguments %D"? So, yes, please provide a PR :-) |
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. |
Thanks for the input. Will do. |
Closed by #2080 ! |
* Clarify exactly how calledOnceWith* works ref discussions in sinonjs#1971, sinonjs#1686, sinonjs#2006 Makes it clearer how these methods work. It was unclear to me whether these methods would return true if one of many calls had been made using these args (although that would have made it a duplicate of the `calledWith*` methods).
Is your feature request related to a problem? Please describe.
Closely related to #1247, but in this case I'd like to be able to type
Sinon.assert.calledOnceWithExactly(stub, arg1, ... argN)
Describe the solution you'd like
I believe that there just needs to be an entry in
assert.js
to facilitate this. I'm not entirely sure what the failure message (including interpolated variables) should be though.Possibly just this addition to assert.js?
mirrorPropAsAssertion("calledOnceWithExactly", "expected %n to be called once with exact arguments %D");
Describe alternatives you've considered
The equivalent functionality with today's Sinon is:
If I could get some agreement on what the assertion message should be, then I'd be happy to generate a PR.
The text was updated successfully, but these errors were encountered: