From 84094573fbb2f126614d49a77497466195980366 Mon Sep 17 00:00:00 2001 From: Shakker Date: Fri, 8 May 2026 18:42:11 +0100 Subject: [PATCH] test: tighten deepgram audio request assertion --- extensions/deepgram/audio.test.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/extensions/deepgram/audio.test.ts b/extensions/deepgram/audio.test.ts index 657d2308fa1..92f424d0cee 100644 --- a/extensions/deepgram/audio.test.ts +++ b/extensions/deepgram/audio.test.ts @@ -55,14 +55,17 @@ describe("transcribeDeepgramAudio", () => { expect(seenUrl).toBe( "https://api.example.com/v1/listen?model=nova-3&language=en&punctuate=false&smart_format=true", ); - expect(seenInit?.method).toBe("POST"); - expect(seenInit?.signal).toBeInstanceOf(AbortSignal); + if (!seenInit) { + throw new Error("Expected Deepgram fetch request init"); + } + expect(seenInit.method).toBe("POST"); + expect(seenInit.signal).toBeInstanceOf(AbortSignal); - const headers = new Headers(seenInit?.headers); + const headers = new Headers(seenInit.headers); expect(headers.get("authorization")).toBe("Token test-key"); expect(headers.get("x-custom")).toBe("1"); expect(headers.get("content-type")).toBe("audio/wav"); - expect(seenInit?.body).toBeInstanceOf(Uint8Array); + expect(seenInit.body).toBeInstanceOf(Uint8Array); }); it("throws when the provider response omits transcript", async () => {