Wait for the PCM payload, not just the request, in the live WebSocket test (race under load)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas WintherandClaude Opus 5.5 committed 2026-10-29 21:58:03 +01:00
1 parent d6c3d1ff70
commit f7d0525423
1 file changed
+3 -1
+3 -1
View File
@@ -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" }),
);