Skip to content

Commit aa1f208

Browse files
committed
fix middleware and use toMatchObject
1 parent 55aa5ac commit aa1f208

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

dev-packages/e2e-tests/test-applications/node-express/src/app.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ import { mcpRouter } from './mcp';
2525
const app = express();
2626
const port = 3030;
2727

28-
app.use(express.json());
29-
3028
app.use(mcpRouter);
3129

3230
app.get('/crash-in-with-monitor/:id', async (req, res) => {

dev-packages/e2e-tests/test-applications/node-express/src/mcp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ mcpRouter.get('/sse', async (_, res) => {
5151
await server.connect(transport);
5252
});
5353

54-
mcpRouter.post('/messages', async (req, res) => {
54+
mcpRouter.post('/messages', express.json(), async (req, res) => {
5555
const sessionId = req.query.sessionId;
5656
const transport = transports[sessionId as string];
5757
if (transport) {

dev-packages/e2e-tests/test-applications/node-express/tests/errors.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ test('Sends correct error event', async ({ baseURL }) => {
1313
expect(errorEvent.exception?.values).toHaveLength(1);
1414
expect(errorEvent.exception?.values?.[0]?.value).toBe('This is an exception with id 123');
1515

16-
expect(errorEvent.request).toEqual({
16+
expect(errorEvent.request).toMatchObject({
1717
method: 'GET',
1818
cookies: {},
1919
headers: expect.any(Object),
@@ -43,11 +43,11 @@ test('Should record caught exceptions with local variable', async ({ baseURL })
4343

4444
test('To not crash app from withMonitor', async ({ baseURL }) => {
4545
const doRequest = async (id: number) => {
46-
const response = await fetch(`${baseURL}/crash-in-with-monitor/${id}`)
46+
const response = await fetch(`${baseURL}/crash-in-with-monitor/${id}`);
4747
return response.json();
48-
}
49-
const [response1, response2] = await Promise.all([doRequest(1), doRequest(2)])
50-
expect(response1.message).toBe('This is an exception withMonitor: 1')
51-
expect(response2.message).toBe('This is an exception withMonitor: 2')
52-
expect(response1.pid).toBe(response2.pid) //Just to double-check, TBS
48+
};
49+
const [response1, response2] = await Promise.all([doRequest(1), doRequest(2)]);
50+
expect(response1.message).toBe('This is an exception withMonitor: 1');
51+
expect(response2.message).toBe('This is an exception withMonitor: 2');
52+
expect(response1.pid).toBe(response2.pid); //Just to double-check, TBS
5353
});

0 commit comments

Comments
 (0)