From 967ef47a5ea0cf31ec49ecd75174073e058c3c13 Mon Sep 17 00:00:00 2001 From: Chris Portscheller Date: Mon, 16 Nov 2026 19:10:57 -0600 Subject: [PATCH] test(client): stop the renewal-spread test timing out It advanced fake time one second at a time from zero, about 3,300 async timer flushes per tab. That ran 4s locally and timed out at Jest's 5s on CI. Jump to 1500s first (no spread renews before 1620s), assert nothing renewed early, then step. 0.4s now; still fails when both tabs use the same spread. --- packages/client/src/clearance-renewal.test.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/client/src/clearance-renewal.test.ts b/packages/client/src/clearance-renewal.test.ts index 3cc5997..46bb7f3 100644 --- a/packages/client/src/clearance-renewal.test.ts +++ b/packages/client/src/clearance-renewal.test.ts @@ -109,8 +109,12 @@ test('two pages with different spreads renew at different times', async () => { jest.setSystemTime(new Date('2026-10-12T00:00:00Z')); cookie = 'wd_clearance=' + token(); startClearance(opts); - await advance(1200); - let elapsed = 1200; + // Jump to 1500 s in one step: no spread renews before 1620 s (1800 s token, + // 120 s margin, at most half the margin earlier). Stepping a second at a + // time from zero took thousands of async timer flushes and timed out on CI. + await advance(1_500_000); + expect(fetchMock).not.toHaveBeenCalled(); + let elapsed = 1_500_000; while (fetchMock.mock.calls.length === 0 && elapsed < 1_800_000) { await advance(1000); elapsed += 1000; } return elapsed; };