Skip to content

Commit 39f2ec8

Browse files
authored
test(NODE-7179): migrate tests to import directly from src folder (#4736)
1 parent 9b34953 commit 39f2ec8

File tree

138 files changed

+445
-435
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+445
-435
lines changed

test/csfle-kms-providers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type KMSProviders } from './mongodb';
1+
import { type KMSProviders } from './../src';
22

33
const csfleKMSProviders = {
44
aws: {

test/integration/auth/auth.prose.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { expect } from 'chai';
22
import * as sinon from 'sinon';
33

4-
import { Connection, LEGACY_HELLO_COMMAND, type MongoClient, ScramSHA256 } from '../../mongodb';
4+
import { type MongoClient } from '../../../src';
5+
import { ScramSHA256 } from '../../../src/cmap/auth/scram';
6+
import { Connection } from '../../../src/cmap/connection';
7+
import { LEGACY_HELLO_COMMAND } from '../../../src/constants';
58
import { type TestConfiguration } from '../../tools/runner/config';
69

710
function makeConnectionString(config, username, password) {

test/integration/auth/mongodb_aws.prose.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import * as process from 'node:process';
22

33
import { expect } from 'chai';
44

5-
import { AWSSDKCredentialProvider, type MongoClient, MongoServerError } from '../../mongodb';
5+
import { type MongoClient, MongoServerError } from '../../../src';
6+
import { AWSSDKCredentialProvider } from '../../../src/cmap/auth/aws_temporary_credentials';
67

78
const isMongoDBAWSAuthEnvironment = (process.env.MONGODB_URI ?? '').includes('MONGODB-AWS');
89

test/integration/auth/mongodb_aws.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@ import * as http from 'http';
55
import { performance } from 'perf_hooks';
66
import * as sinon from 'sinon';
77

8-
import { refreshKMSCredentials } from '../../../src/client-side-encryption/providers';
98
import {
10-
AWSSDKCredentialProvider,
119
type CommandOptions,
12-
Connection,
1310
type Document,
1411
MongoAWSError,
1512
type MongoClient,
16-
MongoDBAWS,
1713
type MongoDBNamespace,
1814
type MongoDBResponseConstructor,
1915
MongoMissingCredentialsError,
2016
MongoMissingDependencyError,
21-
MongoServerError,
22-
setDifference
23-
} from '../../mongodb';
17+
MongoServerError
18+
} from '../../../src';
19+
import { refreshKMSCredentials } from '../../../src/client-side-encryption/providers';
20+
import { AWSSDKCredentialProvider } from '../../../src/cmap/auth/aws_temporary_credentials';
21+
import { MongoDBAWS } from '../../../src/cmap/auth/mongodb_aws';
22+
import { Connection } from '../../../src/cmap/connection';
23+
import { setDifference } from '../../../src/utils';
2424

2525
const isMongoDBAWSAuthEnvironment = (process.env.MONGODB_URI ?? '').includes('MONGODB-AWS');
2626

test/integration/auth/mongodb_oidc.prose.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import {
88
type ClientSession,
99
type Collection,
1010
MongoClient,
11-
type MongoDBOIDC,
1211
type OIDCCallbackParams,
1312
type OIDCResponse
14-
} from '../../mongodb';
13+
} from '../../../src';
14+
import { type MongoDBOIDC } from '../../../src/cmap/auth/mongodb_oidc';
1515

1616
const createCallback = (tokenFile = 'test_user1', expiresInSeconds?: number, extraFields?: any) => {
1717
return async (params: OIDCCallbackParams) => {

test/integration/auth/mongodb_oidc_azure.prose.05.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, MongoClient, type MongoClientOptions } from '../../mongodb';
3+
import { type Collection, MongoClient, type MongoClientOptions } from '../../../src';
44

55
const DEFAULT_URI = 'mongodb://127.0.0.1:27017';
66

test/integration/auth/mongodb_oidc_gcp.prose.06.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, MongoClient, type MongoClientOptions } from '../../mongodb';
3+
import { type Collection, MongoClient, type MongoClientOptions } from '../../../src';
44

55
const DEFAULT_URI = 'mongodb://127.0.0.1:27017';
66

test/integration/auth/mongodb_oidc_k8s.prose.07.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, MongoClient } from '../../mongodb';
3+
import { type Collection, MongoClient } from '../../../src';
44

55
const DEFAULT_URI = 'mongodb://127.0.0.1:27017';
66

test/integration/causal-consistency/causal_consistency.prose.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
const { LEGACY_HELLO_COMMAND } = require('../../mongodb');
3+
const { LEGACY_HELLO_COMMAND } = require('../../../src/constants');
44

55
const { setupDatabase } = require('../shared');
66
const { expect } = require('chai');

test/integration/change-streams/change_streams.prose.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ import {
1010
type CommandStartedEvent,
1111
type CommandSucceededEvent,
1212
type Document,
13-
LEGACY_HELLO_COMMAND,
1413
Long,
1514
type MongoClient,
1615
MongoNetworkError,
1716
ObjectId,
1817
Timestamp
19-
} from '../../mongodb';
18+
} from '../../../src';
19+
import { LEGACY_HELLO_COMMAND } from '../../../src/constants';
2020
import * as mock from '../../tools/mongodb-mock/index';
2121
import { setupDatabase } from '../shared';
2222

@@ -31,7 +31,7 @@ function triggerResumableError(changeStream: ChangeStream, delay: number, onClos
3131
function triggerResumableError(
3232
changeStream: ChangeStream,
3333
delay: number | (() => void),
34-
onClose?: () => void
34+
onClose?: (err?: Error) => void
3535
) {
3636
if (typeof delay === 'function') {
3737
onClose = delay;
@@ -53,7 +53,7 @@ function triggerResumableError(
5353
}
5454

5555
const nextStub = sinon.stub(changeStream.cursor, 'next').callsFake(async function () {
56-
callback(new MongoNetworkError('error triggered from test'));
56+
onClose(new MongoNetworkError('error triggered from test'));
5757
nextStub.restore();
5858
});
5959

0 commit comments

Comments
 (0)