From 9a57cd4fc41f04c8df1e6cdc4ee0e71898506124 Mon Sep 17 00:00:00 2001 From: Codeman maintainer Date: Sun, 18 Oct 2026 08:08:46 +0200 Subject: [PATCH] fix(#647): pin the hold timer's own re-render The timer test only checked that a handle existed, and the other hold tests re-rendered by hand, so deleting the re-render from the timer callback left every test green. A new test waits out the hold for real and asserts the suffix appears and the timer is spent with no further call. Co-Authored-By: Claude Opus 5.5 (1M context) --- test/connection-indicator.test.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/connection-indicator.test.ts b/test/connection-indicator.test.ts index 929c1efe..24d4f4bd 100644 --- a/test/connection-indicator.test.ts +++ b/test/connection-indicator.test.ts @@ -203,6 +203,19 @@ describe('connection indicator — a brief burst does not widen the pill', () => app._updateConnectionIndicator(); // cancels it }); + it('shows the count by itself once the hold elapses, and the timer is spent', async () => { + // A real wait, on purpose: the vm context runs on its own Date and the real setTimeout, so this + // exercises the shipped timer callback rather than a manual re-render. + const { app, els } = makeApp({ activeSessionId: 's1', _wsState: 'connected', queuedBytes: 40 }); + app._updateConnectionIndicator(); + expect(els.connectionText.textContent).toBe('WS'); + await new Promise((r) => setTimeout(r, 1400)); + expect(els.connectionText.textContent).toBe('WS · 40B queued'); + expect((app as unknown as { _backlogHoldTimer: unknown })._backlogHoldTimer).toBeNull(); + app._pendingDeliveries.clear(); + app._updateConnectionIndicator(); + }); + it('shows the count once the same backlog has stayed up past the hold', () => { const { app, els } = makeApp({ activeSessionId: 's1', _wsState: 'connected', queuedBytes: 40 }); app._updateConnectionIndicator();