You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not exactly sure what you are trying to do. The documentation for callsFake seems like it just allows you to override the behavior of the stub when invoked.
In order to verify that your stub was called with the correct args, you could do myStub.withArgs(obj).returnsPromise().resolves({}, true).
thanks, I got it to work @astephenb
btw I notice that when the args are not called properly that the error message is pretty bad and not very easy to diagnose
In code below I would like to check the params that I passed to the stubbed function..
const sinon = require('sinon');
var sinonStubPromise = require('sinon-stub-promise');
sinonStubPromise(sinon);
var serviceRequest = require("../../mysql/models")['ServiceRequest'];
var providerRequest = require("../../mysql/models")['ProviderRequest'];
var serviceRequestCreateStub = sinon.stub(serviceRequest, 'create');
var providerRequestCreateStub = sinon.stub(providerRequest, 'create');
...
...
serviceRequestCreateStub.callsFake(function(obj){ /* would like to verify that obj passed in was correct here*/}).returnsPromise().resolves({},true);
The text was updated successfully, but these errors were encountered: