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(server): send the API key requests without awaiting in a loop

Mauricec0f6551cf442
diff --git a/server/tests/e2e/sessions.e2e.test.ts b/server/tests/e2e/sessions.e2e.test.ts
index 842203a88..4f58ff322 100644
--- a/server/tests/e2e/sessions.e2e.test.ts
+++ b/server/tests/e2e/sessions.e2e.test.ts
@@ -322,11 +322,9 @@ describe('Sessions e2e (sign-in sessions that can be ended)', () => {
const forged = `trek_session=${jwt.sign({ id: user.id, pv: 0, iat }, 'not-the-server-secret', { expiresIn: 86400, algorithm: 'HS256' })}`;
const genuine = sessionCookie(user.id, 0, { lifetime: 86400, consumed: 60000 });
- for (const cookie of [forged, genuine]) {
- const res = await request(server)
- .get('/api/v1/trips')
- .set('Authorization', `Bearer ${key}`)
- .set('Cookie', cookie);
+ const withKey = (cookie: string) =>
+ request(server).get('/api/v1/trips').set('Authorization', `Bearer ${key}`).set('Cookie', cookie);
+ for (const res of [await withKey(forged), await withKey(genuine)]) {
expect(res.status).toBe(200);
const set = (res.headers['set-cookie'] ?? []) as unknown as string[];
expect(set.some((c) => c.startsWith('trek_session='))).toBe(false);