How can I make a stub that returns it's own arguments, like so:
var stub = sinon.stub().returns(???);
var result = stub('foo'); //result = foo
This will be nested so I can't return nothing and then check stub.getCall...
Try this
stub.returnsArg(0);
See docs
Modify your code like below:
- var stub = sinon.stub().returns(???);
+ var stub = sinon.stub().returnsArg(0);
var result = stub('foo'); //result = foo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With