If I have a stub for a function that takes 2 callbacks, how can I wire up sinon.js to call both callbacks when the stubbed function is invoked?
For example - here's function that I want to stub which takes 2 functions as arguments:
function stubThisThing(one, two) {
... one and two are functions ...
... contents stubbed by sinon.js ...
}
I can use sinon to call either one of the arguments:
stubbedThing.callsArg(0);
or
stubbedThing.callsArg(1);
but I can't seem to get both to be called. If I try:
stubbedThing.callsArg(0).callsArg(1);
or
stubbedThing.callsArg(0);
stubbedThing.callsArg(1);
then sinon will only ever call the second argument. If I wire it up in the other order, then sinon will call the first arg. However, I'd like both to be called one after the other.