Comparing version 0.2.0 to 1.0.0
{ | ||
"name": "proxmis", | ||
"version": "0.2.0", | ||
"version": "1.0.0", | ||
"description": "A generator for creating promises that can be used as node.js callbacks.", | ||
"main": "proxmis.js", | ||
"scripts": { | ||
"test": "nodeunit test.js" | ||
"test": "tap test.js" | ||
}, | ||
"engines": { | ||
"node": ">=4.2" | ||
}, | ||
"keywords": [ | ||
@@ -19,8 +22,5 @@ "promise", | ||
"license": "MIT", | ||
"dependencies": { | ||
"es6-promise": "~0.1.1" | ||
}, | ||
"devDependencies": { | ||
"nodeunit": "~0.8.6" | ||
"tap": "~8.0.0" | ||
} | ||
} |
var Promise = require('es6-promise').Promise; | ||
var proxmis = function (options) { | ||
module.exports = exports = function proxmis (options) { | ||
var defer, callable; | ||
@@ -49,8 +47,6 @@ var callback; | ||
proxmis.wrap = function (actionable, options) { | ||
var proxy = proxmis(options); | ||
exports.wrap = function (actionable, options) { | ||
var proxy = exports(options); | ||
actionable(proxy); | ||
return proxy; | ||
}; | ||
module.exports = proxmis; |
196
test.js
var test = require('tap').test; | ||
var proxmis = require('./proxmis'); | ||
var Promise = require('es6-promise').Promise; | ||
exports['Promise Resolves'] = function (test) { | ||
test.expect(1); | ||
test('Promise Resolves', (t) => { | ||
t.plan(1); | ||
var prox = proxmis(); | ||
@@ -11,8 +11,8 @@ | ||
function (result) { | ||
test.equal(result, 10); | ||
test.done(); | ||
t.equal(result, 10); | ||
t.done(); | ||
}, | ||
function (error) { | ||
test.ok(false, 'Promise Rejected'); | ||
test.done(); | ||
t.ok(false, 'Promise Rejected'); | ||
t.done(); | ||
} | ||
@@ -22,6 +22,6 @@ ); | ||
prox(null, 10); | ||
}; | ||
}); | ||
exports['Promise Rejects'] = function (test) { | ||
test.expect(1); | ||
test('Promise Rejects', (t) => { | ||
t.plan(1); | ||
var prox = proxmis(); | ||
@@ -31,8 +31,8 @@ | ||
function (result) { | ||
test.ok(false, 'Promise Resolved'); | ||
test.done(); | ||
t.ok(false, 'Promise Resolved'); | ||
t.done(); | ||
}, | ||
function (error) { | ||
test.equal(error, 'Failure'); | ||
test.done(); | ||
t.equal(error, 'Failure'); | ||
t.done(); | ||
} | ||
@@ -42,9 +42,9 @@ ); | ||
prox('Failure', 10); | ||
}; | ||
}); | ||
exports['Promise Resolves - With Callback'] = function (test) { | ||
test.expect(3); | ||
test('Promise Resolves - With Callback', (t) => { | ||
t.plan(3); | ||
var prox = proxmis(function (err, result) { | ||
test.equal(result, 10); | ||
test.equal(err, null); | ||
t.equal(result, 10); | ||
t.equal(err, null); | ||
}); | ||
@@ -54,8 +54,8 @@ | ||
function (result) { | ||
test.equal(result, 10); | ||
test.done(); | ||
t.equal(result, 10); | ||
t.done(); | ||
}, | ||
function (error) { | ||
test.ok(false, 'Promise Rejected'); | ||
test.done(); | ||
t.ok(false, 'Promise Rejected'); | ||
t.done(); | ||
} | ||
@@ -65,9 +65,9 @@ ); | ||
prox(null, 10); | ||
}; | ||
}); | ||
exports['Promise Rejects - With Callback'] = function (test) { | ||
test.expect(3); | ||
test('Promise Rejects - With Callback', (t) => { | ||
t.plan(3); | ||
var prox = proxmis(function (err, result) { | ||
test.equal(result, 10); | ||
test.equal(err, 'Failure'); | ||
t.equal(result, 10); | ||
t.equal(err, 'Failure'); | ||
}); | ||
@@ -77,8 +77,8 @@ | ||
function (result) { | ||
test.ok(false, 'Promise Resolved'); | ||
test.done(); | ||
t.ok(false, 'Promise Resolved'); | ||
t.done(); | ||
}, | ||
function (error) { | ||
test.equal(error, 'Failure'); | ||
test.done(); | ||
t.equal(error, 'Failure'); | ||
t.done(); | ||
} | ||
@@ -88,17 +88,17 @@ ); | ||
prox('Failure', 10); | ||
}; | ||
}); | ||
exports['Casts ES6 promise, and resolves'] = function (test) { | ||
test.expect(1); | ||
test('Casts ES6 promise, and resolves', (t) => { | ||
t.plan(1); | ||
var prox = proxmis(); | ||
var prom = Promise.cast(prox); | ||
var prom = Promise.resolve(prox); | ||
prom.then( | ||
function (result) { | ||
test.equal(result, 10); | ||
test.done(); | ||
t.equal(result, 10); | ||
t.done(); | ||
}, | ||
function (error) { | ||
test.ok(false, 'Promise Rejected'); | ||
test.done(); | ||
t.ok(false, 'Promise Rejected'); | ||
t.done(); | ||
} | ||
@@ -108,17 +108,17 @@ ); | ||
prox(null, 10); | ||
}; | ||
}); | ||
exports['Casts ES6 promise, and rejects'] = function (test) { | ||
test.expect(1); | ||
test('Casts ES6 promise, and rejects', (t) => { | ||
t.plan(1); | ||
var prox = proxmis(); | ||
var prom = Promise.cast(prox); | ||
var prom = Promise.resolve(prox); | ||
prom.then( | ||
function (result) { | ||
test.ok(false, 'Promise Resolved'); | ||
test.done(); | ||
t.ok(false, 'Promise Resolved'); | ||
t.done(); | ||
}, | ||
function (error) { | ||
test.equal(error, 'Failure'); | ||
test.done(); | ||
t.equal(error, 'Failure'); | ||
t.done(); | ||
} | ||
@@ -128,42 +128,42 @@ ); | ||
prox('Failure', 10); | ||
}; | ||
}); | ||
exports['Wrapper with a resolve'] = function (test) { | ||
test.expect(2); | ||
test('Wrapper with a resolve', (t) => { | ||
t.plan(2); | ||
proxmis.wrap(function (callback) { | ||
test.ok('Invoked'); | ||
t.ok('Invoked'); | ||
callback(null, 10); | ||
}).then( | ||
function (result) { | ||
test.equal(result, 10); | ||
test.done(); | ||
t.equal(result, 10); | ||
t.done(); | ||
}, | ||
function (error) { | ||
test.ok(false, 'Promise Rejected'); | ||
test.done(); | ||
t.ok(false, 'Promise Rejected'); | ||
t.done(); | ||
} | ||
); | ||
}; | ||
}); | ||
exports['Wrapper with a rejection'] = function (test) { | ||
test.expect(2); | ||
test('Wrapper with a rejection', (t) => { | ||
t.plan(2); | ||
proxmis.wrap(function (callback) { | ||
test.ok('Invoked'); | ||
t.ok('Invoked'); | ||
callback('Failure', 10); | ||
}).then( | ||
function (result) { | ||
test.ok(false, 'Promise Resolved'); | ||
test.done(); | ||
t.ok(false, 'Promise Resolved'); | ||
t.done(); | ||
}, | ||
function (error) { | ||
test.equal(error, 'Failure'); | ||
test.done(); | ||
t.equal(error, 'Failure'); | ||
t.done(); | ||
} | ||
); | ||
}; | ||
}); | ||
exports['Chained then'] = function (test) { | ||
test.expect(2); | ||
test('Chained then', (t) => { | ||
t.plan(2); | ||
@@ -173,27 +173,27 @@ var prox = proxmis(); | ||
var defer = prox.then(function (result) { | ||
test.ok(true); | ||
t.ok(true); | ||
return result; | ||
}); | ||
defer = defer.then(function (result) { | ||
test.equal(result, 10); | ||
test.done(); | ||
t.equal(result, 10); | ||
t.done(); | ||
}); | ||
prox(null, 10); | ||
}; | ||
}); | ||
exports['Promise Rejects into .catch()'] = function (test) { | ||
test.expect(1); | ||
test('Promise Rejects into .catch()', (t) => { | ||
t.plan(1); | ||
var prox = proxmis(); | ||
prox.catch(function (error) { | ||
test.equal(error, 'Failure'); | ||
test.done(); | ||
t.equal(error, 'Failure'); | ||
t.done(); | ||
}); | ||
prox('Failure', 10); | ||
}; | ||
}); | ||
exports['Promise Resolves from an errorless callback'] = function (test) { | ||
test.expect(1); | ||
test('Promise Resolves from an errorless callback', (t) => { | ||
t.plan(1); | ||
var prox = proxmis({noError: true}); | ||
@@ -203,8 +203,8 @@ | ||
function (result) { | ||
test.equal(result, 20); | ||
test.done(); | ||
t.equal(result, 20); | ||
t.done(); | ||
}, | ||
function (error) { | ||
test.ok(false, 'Promise Rejected'); | ||
test.done(); | ||
t.ok(false, 'Promise Rejected'); | ||
t.done(); | ||
} | ||
@@ -214,6 +214,6 @@ ); | ||
prox(20, 10); | ||
}; | ||
}); | ||
exports['Promise Resolves with all arguments'] = function (test) { | ||
test.expect(1); | ||
test('Promise Resolves with all arguments', (t) => { | ||
t.plan(1); | ||
var prox = proxmis({allArgs: true}); | ||
@@ -223,8 +223,8 @@ | ||
function (result) { | ||
test.deepEqual(result, [20, 10]); | ||
test.done(); | ||
t.deepEqual(result, [20, 10]); | ||
t.done(); | ||
}, | ||
function (error) { | ||
test.ok(false, 'Promise Rejected'); | ||
test.done(); | ||
t.ok(false, 'Promise Rejected'); | ||
t.done(); | ||
} | ||
@@ -234,20 +234,20 @@ ); | ||
prox(20, 10); | ||
}; | ||
}); | ||
exports['Wrapper supports options'] = function (test) { | ||
test.expect(2); | ||
test('Wrapper supports options', (t) => { | ||
t.plan(2); | ||
proxmis.wrap(function (callback) { | ||
test.ok('Invoked'); | ||
t.ok('Invoked'); | ||
callback(10); | ||
}, {noError:true}).then( | ||
function (result) { | ||
test.equal(result, 10); | ||
test.done(); | ||
t.equal(result, 10); | ||
t.done(); | ||
}, | ||
function (error) { | ||
test.ok(false, 'Promise Rejected'); | ||
test.done(); | ||
t.ok(false, 'Promise Rejected'); | ||
t.done(); | ||
} | ||
); | ||
}; | ||
}); |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
1
7992
243
- Removedes6-promise@~0.1.1
- Removedes6-promise@0.1.2(transitive)