Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

test(tours): send the refused place searches one after another

Maurice3332495b7a7a
diff --git a/server/tests/e2e/tours-planned.e2e.test.ts b/server/tests/e2e/tours-planned.e2e.test.ts
index caa53338f..cc862b10e 100644
--- a/server/tests/e2e/tours-planned.e2e.test.ts
+++ b/server/tests/e2e/tours-planned.e2e.test.ts
@@ -735,12 +735,16 @@ describe('Tours planned e2e (real guards + temp SQLite)', () => {
{ ...body, line: [[47, 11]] },
{ ...body, add: 1 },
];
- const refused = await Promise.all(
- bad.map((sent) =>
- request(server).post('/api/trips/5/tours/poi-search').set('Cookie', sessionCookie(OWNER)).send(sent),
- ),
+ // One after another: the server under test takes one connection at a time.
+ const refused = await bad.reduce<Promise<number[]>>(
+ async (done, sent) => [
+ ...(await done),
+ (await request(server).post('/api/trips/5/tours/poi-search').set('Cookie', sessionCookie(OWNER)).send(sent))
+ .status,
+ ],
+ Promise.resolve([]),
);
- expect(refused.map((res) => res.status)).toEqual([400, 400, 400, 400]);
+ expect(refused).toEqual([400, 400, 400, 400]);
expect((await request(server).post('/api/trips/5/tours/poi-search').send(body)).status).toBe(401);
});
});