What I am trying to achieve is to stub a call which will return a certain value. That return value consists of one of the passed parameters and a new value.
How can I grab the argument of a stub and use it to form a return value for a given stub call
E.g.
mockDb.query.onCall(0).return(
Tuple(this.args(0), "Some other data");
);
I know I can do this:
sinon.stub(obj, "hello", function (a) {
return a;
});
However, this works on the entire stub and not an individual stub call. Unfortunately, I am not able to provide a different stub for different calls, as I have just one object(the db stub).
Aucun commentaire:
Enregistrer un commentaire