Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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 = {
Expand All @@ -186,22 +188,10 @@ 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').insert({ a: 1 }, { writeConcern: { w: 1 } });

done();
});
}
);
const items = await db.collection('domainSocketCollection0').find({ a: 1 }).toArray();
test.equal(1, items.length);
}
});

Expand Down