From 6daf645fd0c772197f8299d8e73cdf3b2df70b19 Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Tue, 3 Nov 2026 02:04:13 +0000 Subject: [PATCH] test(ui-react): derive the wall-backstop saved time from the recorded row The registered wall backstop test records native audio in real time and then asserted a hard-coded "Saved up to 0:00". Whenever capture passed 1000 ms before the stop, production correctly reported 0:01, and the test failed on a slow runner (main red at b9fb28b6b, run 41560483270). Derive the expected m:ss from the row's savedThroughMs with a formatter written independently of production's. Closes #3419 Co-Authored-By: Claude Opus 5.5 --- .../ui-react/tests/browser/recording-limits.offline.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/ui-react/tests/browser/recording-limits.offline.tsx b/packages/ui-react/tests/browser/recording-limits.offline.tsx index 66dadbdf7c..d6a4f86cb8 100644 --- a/packages/ui-react/tests/browser/recording-limits.offline.tsx +++ b/packages/ui-react/tests/browser/recording-limits.offline.tsx @@ -8,6 +8,11 @@ import { generateWav, AUDIO_FIXTURES } from "./offline/audio-fixtures.ts"; import { recordingCell } from "./offline/recording-cell.ts"; import { installWavMicrophone, watchMicrophone } from "./offline/fake-microphone.ts"; +/** The user-facing m:ss for committed audio, written independently of production's formatter. + * Native capture advances in real time, so a test that does not control the clock derives the + * expected text from the row it read rather than assuming how far capture got. */ +const savedClock = (ms: number) => `${Math.floor(ms / 60_000)}:${(Math.floor(ms / 1000) % 60).toString().padStart(2, "0")}`; + test("registered production warning and deadline finalize short native audio and release capture resources", async (ctx) => { const c = recordingCell(ctx); const microphone = watchMicrophone(); @@ -329,7 +334,7 @@ test("registered wall backstop finalizes native audio as interrupted", async (ct expect(row.savedThroughMs).toBeLessThan(10_000); expect(row.durationMs).toBe(row.savedThroughMs); expect(c.events.filter((event) => event.kind === "warning")).toHaveLength(1); - expect(c.events.at(-1)).toEqual({ kind: "stopped", savedThroughMs: row.savedThroughMs, message: `Recording stopped. Saved up to 0:00; the end may be missing.` }); + expect(c.events.at(-1)).toEqual({ kind: "stopped", savedThroughMs: row.savedThroughMs, message: `Recording stopped. Saved up to ${savedClock(row.savedThroughMs)}; the end may be missing.` }); expect(microphone.streams).toHaveLength(1); expect(microphone.streams[0]!.getTracks().every((track) => track.readyState === "ended")).toBe(true); expect(c.store.active()).toBeNull();