Comparing version 1.1.1 to 1.1.2
{ | ||
"name": "promisize", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Easily support both callbacks and promises in your js lib", | ||
@@ -25,5 +25,5 @@ "main": "index.js", | ||
"devDependencies": { | ||
"standard": "^9.0.2", | ||
"standard": "^10.0.2", | ||
"tape": "^4.6.3" | ||
} | ||
} |
24
test.js
@@ -19,6 +19,6 @@ var promisize = require('.') | ||
t.equal(cb.promise, undefined) | ||
cb('error') | ||
cb(new Error('error')) | ||
function callback (err, result) { | ||
t.equal(err, 'error') | ||
t.ok(err instanceof Error) | ||
t.equal(result, undefined) | ||
@@ -46,9 +46,21 @@ t.end() | ||
cb.promise.catch(function (err) { | ||
t.equal(err, 'error') | ||
t.ok(err instanceof Error) | ||
t.end() | ||
}) | ||
cb('error') | ||
cb(new Error('error')) | ||
}) | ||
test('call callback before promise.then', function (t) { | ||
var cb = promisize(undefined) | ||
t.notEqual(cb.promise, undefined) | ||
cb(null, 'foobar') | ||
cb.promise.then(function (result) { | ||
t.equal(result, 'foobar') | ||
t.end() | ||
}) | ||
}) | ||
// ******************************************************************** | ||
@@ -84,6 +96,6 @@ // ***** Pretend there is no native Promise support from here on ****** | ||
t.equal(cb.promise, undefined) | ||
cb('error') | ||
cb(new Error('error')) | ||
function callback (err, result) { | ||
t.equal(err, 'error') | ||
t.ok(err instanceof Error) | ||
t.equal(result, undefined) | ||
@@ -90,0 +102,0 @@ t.end() |
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
6309
106