Skip to content

Commit 9387232

Browse files
committed
move inits inside describe, fix timeout setting
1 parent 593a7d2 commit 9387232

File tree

2 files changed

+26
-27
lines changed

2 files changed

+26
-27
lines changed

tests/integration/server.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
22
import { Server } from "../../src/server.js";
33
import { setupIntegrationTest } from "./helpers.js";
44

5-
let client: Client;
6-
let server: Server;
5+
describe("Server integration test", () => {
6+
let client: Client;
7+
let server: Server;
78

8-
beforeEach(async () => {
9-
({ client, server } = await setupIntegrationTest());
10-
});
9+
beforeEach(async () => {
10+
({ client, server } = await setupIntegrationTest());
11+
});
1112

12-
afterEach(async () => {
13-
await client?.close();
14-
await server?.close();
15-
});
13+
afterEach(async () => {
14+
await client?.close();
15+
await server?.close();
16+
});
1617

17-
describe("Server integration test", () => {
1818
describe("list capabilities", () => {
1919
it("should return positive number of tools", async () => {
2020
const tools = await client.listTools();

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

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,27 @@ import runner from "mongodb-runner";
66
import defaultState from "../../../../src/state.js";
77
import config from "../../../../src/config.js";
88

9-
let client: Client;
10-
let server: Server;
9+
describe("Connect tool", () => {
10+
let client: Client;
11+
let server: Server;
1112

12-
let loadCredentialsMock: jest.SpyInstance | undefined;
13-
let cluster: runner.MongoCluster;
13+
let loadCredentialsMock: jest.SpyInstance | undefined;
14+
let cluster: runner.MongoCluster;
1415

15-
beforeAll(async () => {
16-
jest.setTimeout(30000);
17-
cluster = await runMongoDB();
18-
});
16+
beforeAll(async () => {
17+
cluster = await runMongoDB();
18+
}, 60_000);
1919

20-
afterEach(async () => {
21-
loadCredentialsMock?.mockRestore();
22-
await client?.close();
23-
await server?.close();
24-
});
20+
afterEach(async () => {
21+
loadCredentialsMock?.mockRestore();
22+
await client?.close();
23+
await server?.close();
24+
});
2525

26-
afterAll(async () => {
27-
await cluster.close();
28-
});
26+
afterAll(async () => {
27+
await cluster.close();
28+
});
2929

30-
describe("Connect tool", () => {
3130
describe("with default config", () => {
3231
beforeEach(async () => {
3332
loadCredentialsMock = jest.spyOn(defaultState, "loadCredentials").mockImplementation(async () => true);

0 commit comments

Comments
 (0)