diff --git a/test/integration/connection-monitoring-and-pooling/connection.test.ts b/test/integration/connection-monitoring-and-pooling/connection.test.ts index eb6a8b39821..64e7f5c952c 100644 --- a/test/integration/connection-monitoring-and-pooling/connection.test.ts +++ b/test/integration/connection-monitoring-and-pooling/connection.test.ts @@ -1,26 +1,28 @@ +import { type EventEmitter, once } from 'node:events'; +import { setTimeout } from 'node:timers'; + import { expect } from 'chai'; -import { type EventEmitter, once } from 'events'; import * as sinon from 'sinon'; -import { setTimeout } from 'timers'; import { - addContainerMetadata, Binary, - connect, - Connection, type ConnectionOptions, - HostAddress, - LEGACY_HELLO_COMMAND, - makeClientMetadata, MongoClient, MongoClientAuthProviders, type MongoClientOptions, - MongoDBResponse, MongoServerError, - ns, - ServerHeartbeatStartedEvent, - Topology -} from '../../mongodb'; + ServerHeartbeatStartedEvent +} from '../../../src'; +import { connect } from '../../../src/cmap/connect'; +import { Connection } from '../../../src/cmap/connection'; +import { + addContainerMetadata, + makeClientMetadata +} from '../../../src/cmap/handshake/client_metadata'; +import { MongoDBResponse } from '../../../src/cmap/wire_protocol/responses'; +import { LEGACY_HELLO_COMMAND } from '../../../src/constants'; +import { Topology } from '../../../src/sdam/topology'; +import { HostAddress, ns } from '../../../src/utils'; import * as mock from '../../tools/mongodb-mock/index'; import { processTick, sleep } from '../../tools/utils'; import { assert as test, setupDatabase } from '../shared'; @@ -173,7 +175,7 @@ describe('Connection', function () { metadata: { requires: { topology: 'single', os: '!win32' } }, - test: function (done) { + test: async function () { const configuration = this.configuration; const uri = `mongodb://${encodeURIComponent('/tmp/mongodb-27017.sock')}?w=1`; const options: MongoClientOptions = { @@ -186,22 +188,12 @@ describe('Connection', function () { const db = client.db(configuration.db); - db.collection('domainSocketCollection0').insert( - { a: 1 }, - { writeConcern: { w: 1 } }, - function (err) { - expect(err).to.not.exist; - - db.collection('domainSocketCollection0') - .find({ a: 1 }) - .toArray(function (err, items) { - expect(err).to.not.exist; - test.equal(1, items.length); + await db + .collection('domainSocketCollection0') + .insertOne({ a: 1 }, { writeConcern: { w: 1 } }); - done(); - }); - } - ); + const items = await db.collection('domainSocketCollection0').find({ a: 1 }).toArray(); + test.equal(1, items.length); } });