-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathpromise_stats.test.js
More file actions
39 lines (33 loc) · 910 Bytes
/
promise_stats.test.js
File metadata and controls
39 lines (33 loc) · 910 Bytes
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
36
37
38
39
'use strict';
const { assert: test, setupDatabase } = require('../shared');
const f = require('util').format;
describe('stats', function () {
before(function () {
return setupDatabase(this.configuration);
});
it('Should correctly execute stats using Promise', {
metadata: {
requires: {
topology: ['single']
}
},
test: function (done) {
var configuration = this.configuration;
var url = configuration.url();
url =
url.indexOf('?') !== -1
? f('%s&%s', url, 'maxPoolSize=5')
: f('%s?%s', url, 'maxPoolSize=5');
const client = configuration.newClient(url);
client.connect().then(function (client) {
client
.db(configuration.db)
.stats()
.then(function (stats) {
test.ok(stats != null);
client.close(done);
});
});
}
});
});