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

Sent at once, the requests reset each other's connection on CI.
This commit is contained in:
Maurice
2026-10-19 17:25:59 +02:00
parent 75d8351fec
commit 3332495b7a
+9 -5
View File
@@ -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);
});
});