Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 3 additions & 5 deletions tests/integration/server.test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { Server } from "../../src/server.js";
import { setupIntegrationTest } from "./helpers.js";

describe("Server integration test", () => {
let client: Client;
let server: Server;
let teardown: () => Promise<void>;

beforeEach(async () => {
({ client, server } = await setupIntegrationTest());
({ client, teardown } = await setupIntegrationTest());
});

afterEach(async () => {
await client?.close();
await server?.close();
await teardown();
});

describe("list capabilities", () => {
Expand Down
10 changes: 4 additions & 6 deletions tests/integration/tools/mongodb/connect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ describe("Connect tool", () => {
cluster = await runMongoDB();
}, 60_000);

beforeEach(async () => {
({ client, teardown: serverClientTeardown } = await setupIntegrationTest());
});

afterEach(async () => {
await serverClientTeardown?.();
});
Expand All @@ -23,10 +27,6 @@ describe("Connect tool", () => {
});

describe("with default config", () => {
beforeEach(async () => {
({ client, teardown: serverClientTeardown } = await setupIntegrationTest());
});

it("should have correct metadata", async () => {
const tools = await client.listTools();
const connectTool = tools.tools.find((tool) => tool.name === "connect");
Expand Down Expand Up @@ -84,8 +84,6 @@ describe("Connect tool", () => {
describe("with connection string in config", () => {
beforeEach(async () => {
config.connectionString = cluster.connectionString;

({ client, teardown: serverClientTeardown } = await setupIntegrationTest());
});

it("uses the connection string from config", async () => {
Expand Down
Loading