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 11import { Client } from "@modelcontextprotocol/sdk/client/index.js" ;
2- import { Server } from "../../src/server.js" ;
32import { setupIntegrationTest } from "./helpers.js" ;
43
54describe ( "Server integration test" , ( ) => {
65 let client : Client ;
7- let server : Server ;
6+ let teardown : ( ) => Promise < void > ;
87
98 beforeEach ( async ( ) => {
10- ( { client, server } = await setupIntegrationTest ( ) ) ;
9+ ( { client, teardown } = await setupIntegrationTest ( ) ) ;
1110 } ) ;
1211
1312 afterEach ( async ( ) => {
14- await client ?. close ( ) ;
15- await server ?. close ( ) ;
13+ await teardown ( ) ;
1614 } ) ;
1715
1816 describe ( "list capabilities" , ( ) => {
Original file line number Diff line number Diff line change @@ -14,6 +14,10 @@ describe("Connect tool", () => {
1414 cluster = await runMongoDB ( ) ;
1515 } , 60_000 ) ;
1616
17+ beforeEach ( async ( ) => {
18+ ( { client, teardown : serverClientTeardown } = await setupIntegrationTest ( ) ) ;
19+ } ) ;
20+
1721 afterEach ( async ( ) => {
1822 await serverClientTeardown ?.( ) ;
1923 } ) ;
@@ -23,10 +27,6 @@ describe("Connect tool", () => {
2327 } ) ;
2428
2529 describe ( "with default config" , ( ) => {
26- beforeEach ( async ( ) => {
27- ( { client, teardown : serverClientTeardown } = await setupIntegrationTest ( ) ) ;
28- } ) ;
29-
3030 it ( "should have correct metadata" , async ( ) => {
3131 const tools = await client . listTools ( ) ;
3232 const connectTool = tools . tools . find ( ( tool ) => tool . name === "connect" ) ;
@@ -84,8 +84,6 @@ describe("Connect tool", () => {
8484 describe ( "with connection string in config" , ( ) => {
8585 beforeEach ( async ( ) => {
8686 config . connectionString = cluster . connectionString ;
87-
88- ( { client, teardown : serverClientTeardown } = await setupIntegrationTest ( ) ) ;
8987 } ) ;
9088
9189 it ( "uses the connection string from config" , async ( ) => {
You can’t perform that action at this time.
0 commit comments