From f7d0525423b94e38016e60e7c61080fd9a47ab44 Mon Sep 17 00:00:00 2001 From: Lucas Winther Date: Thu, 29 Oct 2026 21:58:03 +0100 Subject: [PATCH] Wait for the PCM payload, not just the request, in the live WebSocket test (race under load) Co-Authored-By: Claude Opus 5.5 --- tests/server-live.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/server-live.test.ts b/tests/server-live.test.ts index 49ef20b..ce66334 100644 --- a/tests/server-live.test.ts +++ b/tests/server-live.test.ts @@ -121,7 +121,9 @@ describe("createLiveWebSocket", () => { handler.message(ws, toBuffer(speech(1))); handler.message(ws, toBuffer(silence(1.5))); // trailing silence commits the segment - await waitFor(() => sidecar.requests.length > 0); + // The fake records the request before it finishes reading the PCM file — + // wait for the payload itself, or a loaded machine races past it. + await waitFor(() => sidecar.audioPayloads.length > 0); expect(sidecar.requests[0]).toEqual( expect.objectContaining({ model: "base", language: "da", task: "translate" }), );