File tree Expand file tree Collapse file tree 2 files changed +7
-11
lines changed Expand file tree Collapse file tree 2 files changed +7
-11
lines changed Original file line number Diff line number Diff line change 1
1
import { Client } from "@modelcontextprotocol/sdk/client/index.js" ;
2
- import { Server } from "../../src/server.js" ;
3
2
import { setupIntegrationTest } from "./helpers.js" ;
4
3
5
4
describe ( "Server integration test" , ( ) => {
6
5
let client : Client ;
7
- let server : Server ;
6
+ let teardown : ( ) => Promise < void > ;
8
7
9
8
beforeEach ( async ( ) => {
10
- ( { client, server } = await setupIntegrationTest ( ) ) ;
9
+ ( { client, teardown } = await setupIntegrationTest ( ) ) ;
11
10
} ) ;
12
11
13
12
afterEach ( async ( ) => {
14
- await client ?. close ( ) ;
15
- await server ?. close ( ) ;
13
+ await teardown ( ) ;
16
14
} ) ;
17
15
18
16
describe ( "list capabilities" , ( ) => {
Original file line number Diff line number Diff line change @@ -14,6 +14,10 @@ describe("Connect tool", () => {
14
14
cluster = await runMongoDB ( ) ;
15
15
} , 60_000 ) ;
16
16
17
+ beforeEach ( async ( ) => {
18
+ ( { client, teardown : serverClientTeardown } = await setupIntegrationTest ( ) ) ;
19
+ } ) ;
20
+
17
21
afterEach ( async ( ) => {
18
22
await serverClientTeardown ?.( ) ;
19
23
} ) ;
@@ -23,10 +27,6 @@ describe("Connect tool", () => {
23
27
} ) ;
24
28
25
29
describe ( "with default config" , ( ) => {
26
- beforeEach ( async ( ) => {
27
- ( { client, teardown : serverClientTeardown } = await setupIntegrationTest ( ) ) ;
28
- } ) ;
29
-
30
30
it ( "should have correct metadata" , async ( ) => {
31
31
const tools = await client . listTools ( ) ;
32
32
const connectTool = tools . tools . find ( ( tool ) => tool . name === "connect" ) ;
@@ -84,8 +84,6 @@ describe("Connect tool", () => {
84
84
describe ( "with connection string in config" , ( ) => {
85
85
beforeEach ( async ( ) => {
86
86
config . connectionString = cluster . connectionString ;
87
-
88
- ( { client, teardown : serverClientTeardown } = await setupIntegrationTest ( ) ) ;
89
87
} ) ;
90
88
91
89
it ( "uses the connection string from config" , async ( ) => {
You can’t perform that action at this time.
0 commit comments