Skip to content

Commit 4e917f1

Browse files
committed
test(NODE-7179): migrate test/integration/node-specific/*
1 parent bf245d0 commit 4e917f1

17 files changed

Lines changed: 45 additions & 62 deletions

test/integration/node-specific/abort_signal.test.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,18 @@ import {
1010
AggregationCursor,
1111
Code,
1212
type Collection,
13-
Connection,
14-
ConnectionPool,
1513
type Db,
1614
FindCursor,
1715
ListCollectionsCursor,
1816
type Log,
1917
type MongoClient,
2018
MongoServerError,
21-
promiseWithResolvers,
22-
ReadPreference,
23-
setDifference,
24-
StateMachine
25-
} from '../../mongodb';
19+
ReadPreference
20+
} from '../../../src';
21+
import { StateMachine } from '../../../src/client-side-encryption/state_machine';
22+
import { Connection } from '../../../src/cmap/connection';
23+
import { ConnectionPool } from '../../../src/cmap/connection_pool';
24+
import { promiseWithResolvers, setDifference } from '../../../src/utils';
2625
import {
2726
clearFailPoint,
2827
configureFailPoint,

test/integration/node-specific/abstract_cursor.test.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,15 @@ import {
77
AbstractCursor,
88
type Collection,
99
type CommandStartedEvent,
10-
CSOTTimeoutContext,
11-
CursorTimeoutContext,
1210
CursorTimeoutMode,
1311
type FindCursor,
1412
MongoAPIError,
1513
type MongoClient,
1614
MongoCursorExhaustedError,
17-
MongoOperationTimeoutError,
18-
TimeoutContext
19-
} from '../../mongodb';
15+
MongoOperationTimeoutError
16+
} from '../../../src';
17+
import { CursorTimeoutContext } from '../../../src/cursor/abstract_cursor';
18+
import { CSOTTimeoutContext, TimeoutContext } from '../../../src/timeout';
2019
import { clearFailPoint, configureFailPoint } from '../../tools/utils';
2120
import { filterForCommands } from '../shared';
2221

test/integration/node-specific/auto_connect.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import {
1010
MongoClient,
1111
MongoNotConnectedError,
1212
ProfilingLevel,
13-
Topology,
1413
TopologyType
15-
} from '../../mongodb';
14+
} from '../../../src';
15+
import { Topology } from '../../../src/sdam/topology';
1616
import { sleep } from '../../tools/utils';
1717

1818
describe('When executing an operation for the first time', () => {

test/integration/node-specific/auto_encrypter.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import {
77
type MongoClient,
88
MongoNetworkTimeoutError,
99
MongoRuntimeError,
10-
StateMachine,
1110
type UUID
12-
} from '../../mongodb';
11+
} from '../../../src';
12+
import { StateMachine } from '../../../src/client-side-encryption/state_machine';
1313

1414
describe('mongocryptd auto spawn', function () {
1515
let client: MongoClient;

test/integration/node-specific/bson-options/raw.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { expect } from 'chai';
22

3-
import { type Collection, type MongoClient, ObjectId } from '../../../mongodb';
3+
import { type Collection, type MongoClient, ObjectId } from '../../../../src';
44

55
describe('raw bson support', () => {
66
describe('raw', () => {

test/integration/node-specific/bson-options/use_bigint_64.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { expect } from 'chai';
22

33
import {
4-
BSON,
54
type Collection,
65
type Db,
76
MongoAPIError,
87
type MongoClient,
98
type WithId
10-
} from '../../../mongodb';
9+
} from '../../../../src';
10+
import { BSONError, type Document, Long } from '../../../../src/bson';
1111

1212
describe('useBigInt64 option', function () {
1313
let client: MongoClient;
@@ -93,7 +93,7 @@ describe('useBigInt64 option', function () {
9393
});
9494

9595
describe('when set to true at collection level', function () {
96-
let res: WithId<BSON.Document> | null;
96+
let res: WithId<Document> | null;
9797

9898
beforeEach(async function () {
9999
client = await this.configuration.newClient().connect();
@@ -112,7 +112,7 @@ describe('useBigInt64 option', function () {
112112
});
113113

114114
describe('when set to false at collection level', function () {
115-
let res: WithId<BSON.Document> | null;
115+
let res: WithId<Document> | null;
116116

117117
beforeEach(async function () {
118118
client = await this.configuration.newClient().connect();
@@ -131,7 +131,7 @@ describe('useBigInt64 option', function () {
131131
});
132132

133133
describe('when set to true', function () {
134-
let res: WithId<BSON.Document> | null;
134+
let res: WithId<Document> | null;
135135

136136
beforeEach(async function () {
137137
client = await this.configuration.newClient({}, { useBigInt64: true }).connect();
@@ -140,7 +140,7 @@ describe('useBigInt64 option', function () {
140140
await db.dropCollection('useBigInt64Test').catch(() => null);
141141

142142
coll = await db.createCollection('useBigInt64Test');
143-
await coll.insertOne({ a: new BSON.Long(1) });
143+
await coll.insertOne({ a: new Long(1) });
144144

145145
res = await coll.findOne({ a: 1n });
146146
});
@@ -185,7 +185,7 @@ describe('useBigInt64 option', function () {
185185
.listCollections()
186186
.toArray()
187187
.catch(e => e);
188-
expect(e).to.be.instanceOf(BSON.BSONError);
188+
expect(e).to.be.instanceOf(BSONError);
189189
});
190190
});
191191

@@ -202,7 +202,7 @@ describe('useBigInt64 option', function () {
202202
.insertOne({ name: 'bailey ' })
203203
.then(() => null)
204204
.catch(e => e);
205-
expect(e).to.be.instanceOf(BSON.BSONError);
205+
expect(e).to.be.instanceOf(BSONError);
206206
});
207207
});
208208

@@ -219,7 +219,7 @@ describe('useBigInt64 option', function () {
219219
.insertOne({ a: 10n }, { promoteLongs: false, useBigInt64: true })
220220
.catch(e => e);
221221

222-
expect(e).to.be.instanceOf(BSON.BSONError);
222+
expect(e).to.be.instanceOf(BSONError);
223223
});
224224
});
225225
});
@@ -257,7 +257,7 @@ describe('useBigInt64 option', function () {
257257
.listCollections()
258258
.toArray()
259259
.catch(e => e);
260-
expect(e).to.be.instanceOf(BSON.BSONError);
260+
expect(e).to.be.instanceOf(BSONError);
261261
});
262262
});
263263

@@ -274,7 +274,7 @@ describe('useBigInt64 option', function () {
274274
.insertOne({ name: 'bailey ' })
275275
.then(() => null)
276276
.catch(e => e);
277-
expect(e).to.be.instanceOf(BSON.BSONError);
277+
expect(e).to.be.instanceOf(BSONError);
278278
});
279279
});
280280

@@ -290,7 +290,7 @@ describe('useBigInt64 option', function () {
290290
.insertOne({ a: 10n }, { promoteValues: false, useBigInt64: true })
291291
.catch(e => e);
292292

293-
expect(e).to.be.instanceOf(BSON.BSONError);
293+
expect(e).to.be.instanceOf(BSONError);
294294
});
295295
});
296296
});

test/integration/node-specific/bson-options/utf8_validation.test.ts

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,9 @@ import { expect } from 'chai';
22
import * as net from 'net';
33
import * as sinon from 'sinon';
44

5-
import {
6-
BSON,
7-
BSONError,
8-
type Collection,
9-
type MongoClient,
10-
MongoServerError,
11-
OpMsgResponse
12-
} from '../../../mongodb';
5+
import { type Collection, type MongoClient, MongoServerError } from '../../../../src';
6+
import { BSONError, deserialize } from '../../../../src/bson';
7+
import { OpMsgResponse } from '../../../../src/cmap/commands';
138

149
describe('class MongoDBResponse', () => {
1510
let client;
@@ -46,12 +41,8 @@ describe('class MongoDBResponse', () => {
4641

4742
// Check that the server sent us broken BSON (bad UTF)
4843
expect(() => {
49-
BSON.deserialize(spy.returnValues[0], { validation: { utf8: true } });
50-
}).to.throw(
51-
BSON.BSONError,
52-
/Invalid UTF/i,
53-
'did not generate error with invalid utf8'
54-
);
44+
deserialize(spy.returnValues[0], { validation: { utf8: true } });
45+
}).to.throw(BSONError, /Invalid UTF/i, 'did not generate error with invalid utf8');
5546
}
5647

5748
await generateWriteErrorWithInvalidUtf8();

test/integration/node-specific/client_close.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import * as events from 'node:events';
22

33
import { expect } from 'chai';
44

5-
import { getCSFLEKMSProviders } from '../../csfle-kms-providers';
65
import {
76
type Collection,
87
type CommandStartedEvent,
98
type FindCursor,
109
type MongoClient
11-
} from '../../mongodb';
10+
} from '../../../src';
11+
import { getCSFLEKMSProviders } from '../../csfle-kms-providers';
1212
import { configureMongocryptdSpawnHooks } from '../../tools/utils';
1313
import { filterForCommands } from '../shared';
1414
import { runScriptAndGetProcessInfo } from './resource_tracking_script_builder';

test/integration/node-specific/client_encryption.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import { readFileSync } from 'fs';
33
import * as sinon from 'sinon';
44

55
import { MongoCryptError } from '../../../src';
6+
import { Binary, type Collection, Int32, Long, type MongoClient, UUID } from '../../../src';
67
import {
78
ClientEncryption,
89
type DataKey
910
} from '../../../src/client-side-encryption/client_encryption';
1011
import { MongoCryptInvalidArgumentError } from '../../../src/client-side-encryption/errors';
1112
import { StateMachine } from '../../../src/client-side-encryption/state_machine';
12-
import { Binary, type Collection, Int32, Long, type MongoClient, UUID } from '../../mongodb';
1313

1414
function readHttpResponse(path) {
1515
let data = readFileSync(path, 'utf8').toString();

test/integration/node-specific/comment_with_falsy_values.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { expect } from 'chai';
22

3-
import { type Collection, type CommandStartedEvent, Long, type MongoClient } from '../../mongodb';
3+
import { type Collection, type CommandStartedEvent, Long, type MongoClient } from '../../../src';
44
import { TestBuilder, UnifiedTestSuiteBuilder } from '../../tools/unified_suite_builder';
55

66
const falsyValues = [0, false, '', Long.ZERO, null, NaN] as const;

0 commit comments

Comments
 (0)