Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

promised-io

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

promised-io - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

.npmignore

15

package.json
{
"name": "promised-io",
"version": "0.2.2",
"version": "0.2.3",
"author": {

@@ -24,3 +24,5 @@ "name": "Kris Zyp"

"Dean Landolt <dean@deanlandolt.com",
"Nathan Stott <nathan.stott@whiteboard-it.com>"
"Nathan Stott <nathan.stott@whiteboard-it.com>",
"Mark Wubben <mark@novemberborn.net>",
"Vladimir Dronnikov <dronnikov@gmail.com>"
],

@@ -32,10 +34,11 @@ "keywords": [

"mappings": {
"patr": "http://github.com/kriszyp/patr/zipball/v0.2.1"
"patr": "http://github.com/kriszyp/patr/zipball/v0.2.5"
},
"directories": {
"lib": "./lib"
"lib": "."
},
"dependencies":{
"patr": ">=0.2.1"
"main": "./promise",
"testDependencies":{
"patr": ">=0.2.5"
}
}

72

tests/promise.js
var assert = require("assert"),
when = require("promise").when,
defer = require("promise").defer;
when = require("../promise").when,
whenPromise = require("../promise").whenPromise,
defer = require("../promise").defer,
Step = require("../step").Step;

@@ -21,4 +23,70 @@ exports.testSpeedPlainValue = function(){

exports.testWhenPromiseRejectHandled = function(){
// The inner whenPromise doesn't have a rejectCallback, but the outer one does.
// This means the error then *is* handled, but the inner whenPromise doesn't know about that.
// This shouldn't result in an uncaught exception thrown by the promise library.
whenPromise(true, function(){
return whenPromise((function(){
var deferred = defer();
deferred.reject({});
return deferred.promise;
})());
}).then(null, function(){});
};
function veryDeferred(){
var deferred = defer();
setTimeout(function(){
deferred.resolve(true);
}, 100);
return deferred.promise;
}
function veryDeferred(){
var deferred = defer();
setTimeout(function(){
deferred.resolve(true);
}, 100);
return deferred.promise;
}
exports.testStep = function(){
var deferred = defer();
Step({foo: 'bar'}, [
function(){
console.log('S1');
assert.ok(this.foo === 'bar');
return false;
},
function(result){
console.log('S2');
assert.ok(result === false);
this.foo = 'baz';
return veryDeferred();
},
function(result){
console.log('S3');
assert.ok(this.foo === 'baz');
assert.ok(result === true);
throw Error('Catchme!');
},
function(result){
console.log('S4');
assert.ok(result instanceof Error);
assert.ok(result.message === 'Catchme!');
deferred.resolve(true);
// return undefined;
},
function(result){
console.log('S5', result);
// Should never come here
deferred.reject(false);
assert.ok(true === false);
},
]);
return deferred.promise;
};
if (require.main === module)
require("patr/runner").run(exports);
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