Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tunnckoCore committed Sep 29, 2015
1 parent a07b08f commit 56fa1c6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -15,7 +15,8 @@
},
"devDependencies": {
"assertit": "^0.1.0",
"pinkie": "^1.0.0"
"pinkie": "^1.0.0",
"semver": "^5.0.3"
},
"files": [
"index.js"
Expand Down
19 changes: 11 additions & 8 deletions test.js
Expand Up @@ -10,6 +10,7 @@
'use strict'

var test = require('assertit')
var semver = require('semver')
var getPromise = require('./index')

test('should use native Promise if available, Bluebird otherwise', function (done) {
Expand All @@ -20,20 +21,22 @@ test('should use native Promise if available, Bluebird otherwise', function (don

promise.then(function (res) {
test.strictEqual(res, 123)
if (semver.lt(process.version, '0.11.13')) {
test.strictEqual(Promize.___bluebirdPromise, true)
}
done()
})
}, done)
})

test('should use given custom promise module', function (done) {
var Promize = getPromise(require('pinkie'))
var promise = new Promize(function (resolve, reject) {
resolve(123)
})
var promise = Promize.resolve(456)

promise.then(function (res) {
test.strictEqual(res, 123)
test.strictEqual(Promize.___customPromise, true)
test.strictEqual(res, 456)
if (semver.lt(process.version, '0.11.13')) {
test.strictEqual(Promize.___customPromise, true)
}
done()
})
done()
}, done)
})

0 comments on commit 56fa1c6

Please sign in to comment.