Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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 0.0.1 to 0.0.2

31

index.js

@@ -5,30 +5,23 @@

return {
_reject: function(onReject) {
var rejectedValue = onReject(this.rejectValue);
// update reject value for next promise in chain
if (rejectedValue) {
this.rejectValue = rejectedValue;
}
},
then: function(onFulfill, onReject) {
if (this.resolved) {
var resolvedValue = onFulfill(this.resolveValue);
var returned = onFulfill(this.resolveValue);
// promise returned, return that for next handler in chain
if (resolvedValue && resolvedValue.then) {
return resolvedValue;
if (returned && returned.then) {
return returned;
}
// update resolve value for next promise in chain
if (resolvedValue) {
this.resolveValue = resolvedValue;
if (returned) {
this.resolveValue = returned;
}
return this;
}
if (this.rejected && onReject) {
this._reject(onReject);
onReject(this.rejectValue);
return this;
}
return this;

@@ -38,6 +31,6 @@ },

catch: function(onReject) {
if (this.rejected && onReject) {
this._reject(onReject);
if (this.rejected) {
onReject(this.rejectValue);
return this;
}
return this;

@@ -44,0 +37,0 @@ },

{
"name": "sinon-stub-promise",
"version": "0.0.1",
"version": "0.0.2",
"description": "Synchronous Promise stubbing for Sinon.JS",

@@ -5,0 +5,0 @@ "author": "Alex May <alex@substantial.com>",

@@ -155,3 +155,3 @@ var sinon = require('sinon');

it('returns intermediate values from then', function() {
it('returns intermediate values', function() {
promise.resolves();

@@ -168,16 +168,3 @@

});
it('returns intermediate values from catch', function() {
promise.rejects();
var intermediateValue;
promise().catch(function() {
return 'intermediate value';
}).catch(function(value) {
intermediateValue = value;
});
expect(intermediateValue).to.eql('intermediate value');
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc