Skip to content

Commit e6348eb

Browse files
chore: accept partial test suite config on the interface
1 parent 475ea09 commit e6348eb

File tree

12 files changed

+17
-58
lines changed

12 files changed

+17
-58
lines changed

tests/integration/common/connectionManager.oidc.test.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@ import { describe, beforeEach, afterAll, it, expect, vi } from "vitest";
33
import semver from "semver";
44
import process from "process";
55
import type { MongoDBIntegrationTestCase } from "../tools/mongodb/mongodbHelpers.js";
6-
import {
7-
describeWithMongoDB,
8-
isCommunityServer,
9-
getServerVersion,
10-
defaultTestSuiteConfig,
11-
} from "../tools/mongodb/mongodbHelpers.js";
6+
import { describeWithMongoDB, isCommunityServer, getServerVersion } from "../tools/mongodb/mongodbHelpers.js";
127
import { defaultTestConfig, responseAsText, timeout, waitUntil } from "../helpers.js";
138
import type { ConnectionStateConnected, ConnectionStateConnecting } from "../../../src/common/connectionManager.js";
149
import type { UserConfig } from "../../../src/common/config.js";
@@ -143,7 +138,6 @@ describe.skipIf(process.platform !== "linux")("ConnectionManager OIDC Tests", as
143138
addCb?.(oidcIt);
144139
},
145140
{
146-
...defaultTestSuiteConfig,
147141
getUserConfig: () => oidcConfig,
148142
getDriverOptions: () =>
149143
setupDriverConfig({

tests/integration/elicitation.test.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { type UserConfig } from "../../src/common/config.js";
44
import { defaultTestConfig } from "./helpers.js";
55
import { Elicitation } from "../../src/elicitation.js";
66
import { createMockElicitInput } from "../utils/elicitationMocks.js";
7-
import { defaultTestSuiteConfig, describeWithMongoDB } from "./tools/mongodb/mongodbHelpers.js";
7+
import { describeWithMongoDB } from "./tools/mongodb/mongodbHelpers.js";
88

99
function createTestConfig(config: Partial<UserConfig> = {}): UserConfig {
1010
return {
@@ -173,7 +173,6 @@ describe("Elicitation Integration Tests", () => {
173173
});
174174
},
175175
{
176-
...defaultTestSuiteConfig,
177176
getUserConfig: () => createTestConfig(),
178177
getMockElicitationInput: () => mockElicitInput,
179178
}
@@ -202,7 +201,6 @@ describe("Elicitation Integration Tests", () => {
202201
});
203202
},
204203
{
205-
...defaultTestSuiteConfig,
206204
getUserConfig: () => createTestConfig(),
207205
getClientCapabilities: () => ({}),
208206
}
@@ -240,7 +238,6 @@ describe("Elicitation Integration Tests", () => {
240238
});
241239
},
242240
{
243-
...defaultTestSuiteConfig,
244241
getUserConfig: () => createTestConfig({ confirmationRequiredTools: ["list-databases"] }),
245242
getMockElicitationInput: () => mockElicitInput,
246243
}
@@ -291,7 +288,6 @@ describe("Elicitation Integration Tests", () => {
291288
});
292289
},
293290
{
294-
...defaultTestSuiteConfig,
295291
getUserConfig: () => createTestConfig(),
296292
getMockElicitationInput: () => mockElicitInput,
297293
}
@@ -321,7 +317,6 @@ describe("Elicitation Integration Tests", () => {
321317
});
322318
},
323319
{
324-
...defaultTestSuiteConfig,
325320
getUserConfig: () => createTestConfig(),
326321
getMockElicitationInput: () => mockElicitInput,
327322
}

tests/integration/indexCheck.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { defaultTestConfig, getResponseContent } from "./helpers.js";
2-
import { defaultTestSuiteConfig, describeWithMongoDB } from "./tools/mongodb/mongodbHelpers.js";
2+
import { describeWithMongoDB } from "./tools/mongodb/mongodbHelpers.js";
33
import { beforeEach, describe, expect, it } from "vitest";
44

55
describe("IndexCheck integration tests", () => {
@@ -314,7 +314,6 @@ describe("IndexCheck integration tests", () => {
314314
});
315315
},
316316
{
317-
...defaultTestSuiteConfig,
318317
getUserConfig: () => ({
319318
...defaultTestConfig,
320319
indexCheck: true, // Enable indexCheck
@@ -428,7 +427,6 @@ describe("IndexCheck integration tests", () => {
428427
});
429428
},
430429
{
431-
...defaultTestSuiteConfig,
432430
getUserConfig: () => ({
433431
...defaultTestConfig,
434432
indexCheck: false, // Disable indexCheck
@@ -463,7 +461,6 @@ describe("IndexCheck integration tests", () => {
463461
});
464462
},
465463
{
466-
...defaultTestSuiteConfig,
467464
getUserConfig: () => ({
468465
...defaultTestConfig,
469466
// indexCheck not specified, should default to false

tests/integration/resources/exportedData.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { EJSON, Long, ObjectId } from "bson";
44
import { describe, expect, it, beforeEach, afterAll } from "vitest";
55
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
66
import { defaultTestConfig, getDataFromUntrustedContent, resourceChangedNotification, timeout } from "../helpers.js";
7-
import { defaultTestSuiteConfig, describeWithMongoDB } from "../tools/mongodb/mongodbHelpers.js";
7+
import { describeWithMongoDB } from "../tools/mongodb/mongodbHelpers.js";
88
import { contentWithResourceURILink } from "../tools/mongodb/read/export.test.js";
99
import type { UserConfig } from "../../../src/lib.js";
1010

@@ -174,7 +174,6 @@ describeWithMongoDB(
174174
});
175175
},
176176
{
177-
...defaultTestSuiteConfig,
178177
getUserConfig: () => userConfig,
179178
}
180179
);

tests/integration/server.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { defaultTestConfig, expectDefined } from "./helpers.js";
2-
import { defaultTestSuiteConfig, describeWithMongoDB } from "./tools/mongodb/mongodbHelpers.js";
2+
import { describeWithMongoDB } from "./tools/mongodb/mongodbHelpers.js";
33
import { describe, expect, it } from "vitest";
44

55
describe("Server integration test", () => {
@@ -16,7 +16,6 @@ describe("Server integration test", () => {
1616
});
1717
},
1818
{
19-
...defaultTestSuiteConfig,
2019
getUserConfig: () => ({
2120
...defaultTestConfig,
2221
apiClientId: undefined,
@@ -57,7 +56,6 @@ describe("Server integration test", () => {
5756
});
5857
},
5958
{
60-
...defaultTestSuiteConfig,
6159
getUserConfig: () => ({
6260
...defaultTestConfig,
6361
apiClientId: "test",
@@ -89,7 +87,6 @@ describe("Server integration test", () => {
8987
});
9088
},
9189
{
92-
...defaultTestSuiteConfig,
9390
getUserConfig: () => ({
9491
...defaultTestConfig,
9592
readOnly: true,

tests/integration/tools/mongodb/connect/connect.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defaultTestSuiteConfig, describeWithMongoDB } from "../mongodbHelpers.js";
1+
import { describeWithMongoDB } from "../mongodbHelpers.js";
22
import {
33
getResponseContent,
44
getResponseElements,
@@ -81,7 +81,6 @@ describeWithMongoDB(
8181
});
8282
},
8383
{
84-
...defaultTestSuiteConfig,
8584
getUserConfig: (mdbIntegration) => ({
8685
...defaultTestConfig,
8786
connectionString: mdbIntegration.connectionString(),
@@ -160,7 +159,6 @@ describeWithMongoDB(
160159
});
161160
},
162161
{
163-
...defaultTestSuiteConfig,
164162
getUserConfig: () => ({
165163
...defaultTestConfig,
166164
disabledTools: ["connect"],

tests/integration/tools/mongodb/delete/dropIndex.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
validateThrowsForInvalidArguments,
99
validateToolMetadata,
1010
} from "../../../helpers.js";
11-
import { defaultTestSuiteConfig, describeWithMongoDB } from "../mongodbHelpers.js";
11+
import { describeWithMongoDB } from "../mongodbHelpers.js";
1212
import { createMockElicitInput } from "../../../../utils/elicitationMocks.js";
1313
import { Elicitation } from "../../../../../src/elicitation.js";
1414

@@ -174,7 +174,6 @@ describeWithMongoDB(
174174
});
175175
},
176176
{
177-
...defaultTestSuiteConfig,
178177
getMockElicitationInput: () => mockElicitInput,
179178
}
180179
);

tests/integration/tools/mongodb/mongodbHelpers.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export type TestSuiteConfig = {
7575
getClientCapabilities?: () => MockClientCapabilities;
7676
};
7777

78-
export const defaultTestSuiteConfig: TestSuiteConfig = {
78+
const defaultTestSuiteConfig: TestSuiteConfig = {
7979
getUserConfig: () => defaultTestConfig,
8080
getDriverOptions: () => defaultDriverOptions,
8181
downloadOptions: DEFAULT_MONGODB_PROCESS_OPTIONS,
@@ -84,14 +84,12 @@ export const defaultTestSuiteConfig: TestSuiteConfig = {
8484
export function describeWithMongoDB(
8585
name: string,
8686
fn: (integration: MongoDBIntegrationTestCase) => void,
87-
{
88-
getUserConfig,
89-
getDriverOptions,
90-
downloadOptions,
91-
getMockElicitationInput,
92-
getClientCapabilities,
93-
}: TestSuiteConfig = defaultTestSuiteConfig
87+
partialTestSuiteConfig?: Partial<TestSuiteConfig>
9488
): void {
89+
const { getUserConfig, getDriverOptions, downloadOptions, getMockElicitationInput, getClientCapabilities } = {
90+
...defaultTestSuiteConfig,
91+
...partialTestSuiteConfig,
92+
};
9593
describe.skipIf(!MongoDBClusterProcess.isConfigurationSupportedInCurrentEnv(downloadOptions))(name, () => {
9694
const mdbIntegration = setupMongoDBIntegrationTest(downloadOptions);
9795
const mockElicitInput = getMockElicitationInput?.();

tests/integration/tools/mongodb/read/aggregate.test.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@ import {
66
defaultTestConfig,
77
} from "../../../helpers.js";
88
import { beforeEach, describe, expect, it, vi, afterEach } from "vitest";
9-
import {
10-
defaultTestSuiteConfig,
11-
describeWithMongoDB,
12-
getDocsFromUntrustedContent,
13-
validateAutoConnectBehavior,
14-
} from "../mongodbHelpers.js";
9+
import { describeWithMongoDB, getDocsFromUntrustedContent, validateAutoConnectBehavior } from "../mongodbHelpers.js";
1510
import * as constants from "../../../../../src/helpers/constants.js";
1611
import { freshInsertDocuments } from "./find.test.js";
1712

@@ -288,7 +283,6 @@ describeWithMongoDB(
288283
});
289284
},
290285
{
291-
...defaultTestSuiteConfig,
292286
getUserConfig: () => ({ ...defaultTestConfig, maxDocumentsPerQuery: 20 }),
293287
}
294288
);
@@ -348,7 +342,6 @@ describeWithMongoDB(
348342
});
349343
},
350344
{
351-
...defaultTestSuiteConfig,
352345
getUserConfig: () => ({ ...defaultTestConfig, maxBytesPerQuery: 200 }),
353346
}
354347
);
@@ -381,7 +374,6 @@ describeWithMongoDB(
381374
});
382375
},
383376
{
384-
...defaultTestSuiteConfig,
385377
getUserConfig: () => ({ ...defaultTestConfig, maxDocumentsPerQuery: -1, maxBytesPerQuery: -1 }),
386378
}
387379
);

tests/integration/tools/mongodb/read/export.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
validateThrowsForInvalidArguments,
1111
validateToolMetadata,
1212
} from "../../../helpers.js";
13-
import { defaultTestSuiteConfig, describeWithMongoDB } from "../mongodbHelpers.js";
13+
import { describeWithMongoDB } from "../mongodbHelpers.js";
1414
import type { UserConfig } from "../../../../../src/lib.js";
1515

1616
const userConfig: UserConfig = {
@@ -459,7 +459,6 @@ describeWithMongoDB(
459459
});
460460
},
461461
{
462-
...defaultTestSuiteConfig,
463462
getUserConfig: () => userConfig,
464463
}
465464
);

0 commit comments

Comments
 (0)