Skip to content

Commit 431eafc

Browse files
committed
test(hub): give the expiring-token test more room under load
1 parent d26d565 commit 431eafc

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎packages/devtools/src/__tests__/auth-guard.test.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,8 @@ describe('initPangularHub one-time code', () => {
380380
});
381381

382382
it('stops trusting a connected client when its token expires', async () => {
383-
// The token has under two seconds left when the server starts.
384-
const issuedAt = Date.now() - AUTH_TOKEN_TTL_MS + 1500;
383+
// The token has four seconds left, room for the hub to start and the client to be trusted.
384+
const issuedAt = Date.now() - AUTH_TOKEN_TTL_MS + 4000;
385385
const { connect } = await serve((home) => {
386386
const dir = authStoreDir(process.cwd(), home);
387387
mkdirSync(dir, { recursive: true });
@@ -394,10 +394,10 @@ describe('initPangularHub one-time code', () => {
394394
});
395395
const client = await connect('expiring-token');
396396
expect(await client.ensureTrusted(1000)).toBe(true);
397-
await vi.waitFor(() => expect(client.isTrusted).toBe(false), { timeout: 4000 });
397+
await vi.waitFor(() => expect(client.isTrusted).toBe(false), { timeout: 6000 });
398398
const again = await connect('expiring-token');
399399
expect(await again.ensureTrusted(500).catch(() => false)).toBe(false);
400-
});
400+
}, 15_000);
401401

402402
it('drops expired tokens at startup and keeps the rewritten file private', async () => {
403403
const old = Date.now() - AUTH_TOKEN_TTL_MS - 1000;

0 commit comments

Comments
 (0)