Skip to content

Commit 034e710

Browse files
committed
test(mistral): await runaway transcript error
1 parent 822def5 commit 034e710

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎extensions/mistral/realtime-transcription-provider.test.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,11 @@ describe("buildMistralRealtimeTranscriptionProvider", () => {
378378
{ type: "transcription.segment", text: "late segment", start: 0, end: 1 },
379379
{ type: "transcription.done", text: "late done" },
380380
]);
381-
const onError = vi.fn();
381+
let resolveError: (() => void) | undefined;
382+
const errorReceived = new Promise<void>((resolve) => {
383+
resolveError = resolve;
384+
});
385+
const onError = vi.fn(() => resolveError?.());
382386
const onTranscript = vi.fn();
383387
let lastPartialLength = 0;
384388
let partialCalls = 0;
@@ -393,6 +397,7 @@ describe("buildMistralRealtimeTranscriptionProvider", () => {
393397
});
394398

395399
await session.connect();
400+
await errorReceived;
396401
await vi.waitFor(() => {
397402
expect(onError).toHaveBeenCalledExactlyOnceWith(
398403
expect.objectContaining({

0 commit comments

Comments
 (0)