Skip to content

Commit a127cfc

Browse files
committed
test: ✨ Add test to ensure default socketTimeout is 0
1 parent dd92556 commit a127cfc

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

test/functional/mongo_client_options.test.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
'use strict';
2-
const test = require('./shared').assert,
3-
setupDatabase = require('./shared').setupDatabase,
4-
expect = require('chai').expect;
2+
const test = require('./shared').assert;
3+
const setupDatabase = require('./shared').setupDatabase;
4+
const expect = require('chai').expect;
5+
const MongoClient = require('../../lib/mongo_client');
56

67
describe('MongoClient Options', function() {
78
before(function() {
@@ -96,6 +97,17 @@ describe('MongoClient Options', function() {
9697
}
9798
});
9899

100+
it('should default socketTimeout to infinity', function(done) {
101+
const client = new MongoClient(this.configuration.url());
102+
client.connect(() => {
103+
expect(client.s.options.socketTimeoutMS).to.deep.equal(0);
104+
for (const connection of client.topology.s.coreTopology.connections()) {
105+
expect(connection.socketTimeout).to.deep.equal(0);
106+
}
107+
done();
108+
});
109+
});
110+
99111
/**
100112
* @ignore
101113
*/

0 commit comments

Comments
 (0)