Running tests with SinonJS 1.10.x (sorry, can't update the version) I'm facing the following issue
Error: PhantomJS:
expected 0 to equal 1near
What's wrong with the test?
var spyRequester = sinon.spy(util._requesterHandler, '_doCreate');
var result1 = util._requesterHandler.createRequesterIfNotExists(url);
var result2 = util._requesterHandler.createRequesterIfNotExists(url);
assert.equal(spyRequester.callCount, 1); // assertion error
And requestHandler
API is
requesterHandler = {
createRequesterSubscribers: function createRequesterSubscribers(url) {...},
createRequesterIfNotExists: function createRequesterIfNotExists(url, options) {...}
_doCreate: doCreate
}
the piece of code which calls doCreate
inside createRequesterIfNotExists
createRequesterIfNotExists: function createRequesterIfNotExists(url, options) {
var shouldCreate = typeof requesterMap[url] === 'undefined';
var optionsArray = (requesterMap[url] || {}).optionsArray || [];
optionsArray.push(options);
if (shouldCreate) {
requesterMap[url] = doCreate(url, optionsArray); // call doCreate
}
Aucun commentaire:
Enregistrer un commentaire