Skip to content

Commit 72f3d00

Browse files
committed
test: ensure timeout error still makes it to the callback
1 parent 6cc147e commit 72f3d00

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/unit/cmap/connection.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import * as sinon from 'sinon';
66
import { connect } from '../../../src/cmap/connect';
77
import { Connection, hasSessionSupport } from '../../../src/cmap/connection';
88
import { MessageStream } from '../../../src/cmap/message_stream';
9+
import { MongoNetworkTimeoutError } from '../../../src/error';
910
import { isHello, ns } from '../../../src/utils';
1011
import * as mock from '../../tools/mongodb-mock/index';
1112
import { getSymbolFrom } from '../../tools/utils';
@@ -55,7 +56,7 @@ describe('new Connection()', function () {
5556
expect(conn).to.exist;
5657

5758
conn.command(ns('$admin.cmd'), { ping: 1 }, { socketTimeoutMS: 50 }, (err, result) => {
58-
expect(err).to.exist;
59+
expect(err).to.be.instanceOf(MongoNetworkTimeoutError);
5960
expect(result).to.not.exist;
6061

6162
expect(conn).property('stream').property('destroyed').to.be.true;

0 commit comments

Comments
 (0)