🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

sinon-stub-promise

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sinon-stub-promise - npm Package Compare versions

Comparing version

to
0.0.4

5

index.js

@@ -37,3 +37,6 @@

finally: function() {
finally: function(callback) {
if (this.resolved || this.rejected) {
callback();
}
}

@@ -40,0 +43,0 @@ };

2

package.json
{
"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) {