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

Request: expectation.withArgs() supports multiple args #2272

Closed
neverendingqs opened this issue Jul 12, 2020 · 3 comments
Closed

Request: expectation.withArgs() supports multiple args #2272

neverendingqs opened this issue Jul 12, 2020 · 3 comments

Comments

@neverendingqs
Copy link

Is your feature request related to a problem? Please describe.

#992 and #1193 were closed with documentation changes in #1432 that describes the current behaviour:

An expectation instance only holds onto a single set of arguments specified with withArgs. Subsequent calls will overwrite the previously-specified set of arguments (even if they are different), so it is generally not intended that this method be invoked more than once per test case.

A single test may call the same mock multiple times with different arguments, but can not be written at this time due to this limitation.

Describe the solution you'd like

expectations can track multiple withArgs() call, each with their own expectations.

Describe alternatives you've considered

Workarounds with stubs or spies may be possible, but roughly doubles the amount of test code required (once to stub behaviour, and once to verify expectations).

Additional context

None

@mroderick
Copy link
Member

None of the maintainers of Sinon are paid to work on Sinon, and none of us are using the mocking features ourselves.

That means that it is unlikely that the maintainers are going to expand or improve those features. The changes will have to come from contributors.

Having said that, we're a friendly bunch and are happy to help contributors get started.

Would you be interested in making a pull request to make the improvements yourself?

@neverendingqs
Copy link
Author

Thansk @mroderick - makes sense to me.

I will post back if I have time to take a look.

@stale
Copy link

stale bot commented Sep 20, 2020

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.

@stale stale bot added the stale label Sep 20, 2020
@stale stale bot closed this as completed Oct 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants