promised-io
Advanced tools
Comparing version 0.2.2 to 0.2.3
{ | ||
"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" | ||
} | ||
} |
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); | ||
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
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
74243
0
23
2303
4
- Removedpatr@>=0.2.1
- Removedpatr@0.2.6(transitive)
- Removedpromised-io@0.3.6(transitive)