Skip to content

Commit 684aea0

Browse files
committed
Added test to show byo promise library
1 parent c457e2b commit 684aea0

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
, "mongodb-version-manager": "^0.5.0"
2929
, "mongodb-tools": "~1.0"
3030
, "co": "4.5.4"
31+
, "bluebird": "2.9.27"
3132
},
3233
"author": "Christian Kvalheim",
3334
"license": "Apache-2.0",

test/functional/byo_promises_tests.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"use strict";
2+
3+
var f = require('util').format;
4+
5+
exports['Should Correctly Use Blurbird promises library'] = {
6+
metadata: {
7+
requires: {
8+
topology: ['single', 'ssl', 'wiredtiger']
9+
}
10+
},
11+
12+
// The actual test we wish to run
13+
test: function(configuration, test) {
14+
var MongoClient = configuration.require.MongoClient
15+
, Promise = require('bluebird');
16+
17+
MongoClient.connect(configuration.url(), {
18+
promiseLibrary: Promise
19+
}).then(function(db) {
20+
var promise = db.collection('test').insert({a:1});
21+
test.ok(promise instanceof Promise);
22+
23+
promise.then(function() {
24+
db.close();
25+
test.done();
26+
});
27+
});
28+
}
29+
}

test/runner.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ var testFiles =[
252252
, '/test/functional/promises_collection_tests.js'
253253
, '/test/functional/promises_cursor_tests.js'
254254
, '/test/functional/operation_promises_example_tests.js'
255+
, '/test/functional/byo_promises_tests.js'
255256

256257
// Logging tests
257258
, '/test/functional/logger_tests.js'

0 commit comments

Comments
 (0)