sinon-stub-promise
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -37,3 +37,6 @@ | ||
finally: function() { | ||
finally: function(callback) { | ||
if (this.resolved || this.rejected) { | ||
callback(); | ||
} | ||
} | ||
@@ -40,0 +43,0 @@ }; |
{ | ||
"name": "sinon-stub-promise", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Synchronous Promise stubbing for Sinon.JS", | ||
@@ -5,0 +5,0 @@ "author": "Alex May <alex@substantial.com>", |
@@ -142,2 +142,33 @@ var sinon = require('sinon'); | ||
it('does not invoke finally if promise is not resolved or rejected', function() { | ||
var finallyCalled = false; | ||
promise().finally(function() { | ||
finallyCalled = true; | ||
}); | ||
expect(finallyCalled).to.be.false; | ||
}); | ||
it('invokes finally when promise is resolved', function() { | ||
promise.resolves(); | ||
var finallyCalled = false; | ||
promise().finally(function() { | ||
finallyCalled = true; | ||
}); | ||
expect(finallyCalled).to.be.true; | ||
}); | ||
it('invokes finally when promise is rejected', function() { | ||
promise.rejects(); | ||
var finallyCalled = false; | ||
promise().finally(function() { | ||
finallyCalled = true; | ||
}); | ||
expect(finallyCalled).to.be.true; | ||
}); | ||
describe('chaining', function() { | ||
@@ -144,0 +175,0 @@ it('supports then chaining', function(done) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9716
233