Added clean shutdown + tests
This commit is contained in:
parent
3f178b2b7e
commit
7c91349363
1 changed files with 74 additions and 0 deletions
28
src/integration-tests/process-cleanup.test.ts
Normal file
28
src/integration-tests/process-cleanup.test.ts
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import { Server } from "../server/index.js";
|
||||
import { StdioServerTransport } from "../server/stdio.js";
|
||||
|
||||
describe("Process cleanup", () => {
|
||||
jest.setTimeout(5000); // 5 second timeout
|
||||
|
||||
it("should exit cleanly after closing transport", async () => {
|
||||
const server = new Server(
|
||||
{
|
||||
name: "test-server",
|
||||
version: "1.0.0",
|
||||
},
|
||||
{
|
||||
capabilities: {},
|
||||
}
|
||||
);
|
||||
|
||||
const transport = new StdioServerTransport();
|
||||
await server.connect(transport);
|
||||
|
||||
// Close the transport
|
||||
await transport.close();
|
||||
|
||||
// If we reach here without hanging, the test passes
|
||||
// The test runner will fail if the process hangs
|
||||
expect(true).toBe(true);
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue