mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-22 21:11:14 +00:00
test(server): send the API key requests without awaiting in a loop
Server lint counted one no-await-in-loop warning over the tests baseline, from the loop in the new API key test.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user