Skip to content

Commit

Permalink
test: ensure timeout error still makes it to the callback
Browse files Browse the repository at this point in the history
  • Loading branch information
nbbeeken committed Mar 31, 2022
1 parent 6cc147e commit 72f3d00
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/unit/cmap/connection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as sinon from 'sinon';
import { connect } from '../../../src/cmap/connect';
import { Connection, hasSessionSupport } from '../../../src/cmap/connection';
import { MessageStream } from '../../../src/cmap/message_stream';
import { MongoNetworkTimeoutError } from '../../../src/error';
import { isHello, ns } from '../../../src/utils';
import * as mock from '../../tools/mongodb-mock/index';
import { getSymbolFrom } from '../../tools/utils';
Expand Down Expand Up @@ -55,7 +56,7 @@ describe('new Connection()', function () {
expect(conn).to.exist;

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

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

0 comments on commit 72f3d00

Please sign in to comment.