-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
35 lines (31 loc) · 1.01 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* eslint-env node, mocha */
var assert = require('assert');
var EnhancedPromise = require('.');
describe('EnhancedPromise', function() {
it('is externally resolvable', function() {
var enhancedPromise = new EnhancedPromise();
enhancedPromise.resolve('foo');
return enhancedPromise.then(function(value) {
assert.equal(value, 'foo');
});
});
it('is externally rejectable', function() {
var enhancedPromise = new EnhancedPromise();
enhancedPromise.reject('foo');
return enhancedPromise.catch(function(value) {
assert.equal(value, 'foo');
});
});
it('is externally resettable', function() {
var enhancedPromise = EnhancedPromise.resolve('foo');
enhancedPromise.reset();
enhancedPromise.resolve('bar');
return enhancedPromise.then(function(value) {
assert.equal(value, 'bar');
});
});
});
process.on('unhandledRejection', function() {});
describe('Promises/A+ Spec Compliance', function() {
require('promises-aplus-tests').mocha(EnhancedPromise);
});