Skip to content

Commit e559378

Browse files
CopilotJReinhold
andcommitted
test: make /mcp GET handler selection explicit
Co-authored-by: JReinhold <5678122+JReinhold@users.noreply.github.com>
1 parent ec300bd commit e559378

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/addon-mcp/src/preset.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,14 @@ describe('experimental_devServer', () => {
8484
},
8585
} as unknown as Options;
8686

87-
let getHandler: any;
88-
mockApp.get = vi.fn((path, handler) => {
89-
getHandler = handler;
87+
const handlers: Record<string, any> = {};
88+
mockApp.get = vi.fn((path: string, handler: any) => {
89+
handlers[path] = handler;
9090
});
9191

9292
await (experimental_devServer as any)(mockApp, manifestEnabledOptions);
93+
const getMcpHandler = handlers['/mcp'];
94+
expect(getMcpHandler).toBeDefined();
9395

9496
const mockReq = {
9597
headers: {
@@ -101,7 +103,7 @@ describe('experimental_devServer', () => {
101103
end: vi.fn(),
102104
} as any;
103105

104-
await getHandler(mockReq, mockRes);
106+
await getMcpHandler(mockReq, mockRes);
105107

106108
expect(mockRes.end).toHaveBeenCalledWith(
107109
expect.stringContaining('This toolset requires Storybook 10.3.0+ with'),

0 commit comments

Comments
 (0)