Merge pull request #4 from simianhacker/testing/updateMoch

Fixed a test that was actually invalid.
This commit is contained in:
Spencer 2015-06-02 14:28:39 -07:00
commit 6f3a174dd0
2 changed files with 4 additions and 3 deletions

View file

@ -14,7 +14,7 @@ define(function (require) {
if (result === filter) {
return next(filter);
}
throw result;
return Promise.reject(result);
});
};
};

View file

@ -15,13 +15,14 @@ define(function (require) {
it('should create a chaning function which calls the next function if the promise is rejected', function (done) {
var filter = {};
var mapping = sinon.stub();
mapping.returns(Promise.reject());
mapping.returns(Promise.reject(filter));
var mappingChainFn = generateMappingChain(mapping);
var next = sinon.stub();
next.returns(Promise.resolve('good'));
var chain = mappingChainFn(next);
chain({}).then(function (result) {
chain(filter).then(function (result) {
expect(result).to.be('good');
sinon.assert.calledOnce(next);
done();