diff --git a/ui/litellm-dashboard/src/app/(dashboard)/playground/llm_calls/anthropic_messages.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/playground/llm_calls/anthropic_messages.test.tsx index 995104d4b7f..96ace129f87 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/playground/llm_calls/anthropic_messages.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/playground/llm_calls/anthropic_messages.test.tsx @@ -9,7 +9,9 @@ vi.mock("@/components/networking", () => ({ const mockMessagesStream = vi.fn(); vi.mock("@anthropic-ai/sdk", () => ({ - default: vi.fn(() => ({ messages: { stream: mockMessagesStream } })), + default: vi.fn(function () { + return { messages: { stream: mockMessagesStream } }; + }), })); describe("anthropic_messages prompt cache usage", () => { diff --git a/ui/litellm-dashboard/src/app/(dashboard)/playground/llm_calls/audio_speech.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/playground/llm_calls/audio_speech.test.tsx index dbfe8a39959..17f5d0f28a4 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/playground/llm_calls/audio_speech.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/playground/llm_calls/audio_speech.test.tsx @@ -20,13 +20,15 @@ describe("audio_speech", () => { }); // Mock the OpenAI constructor and its methods - (OpenAI as any).mockImplementation(() => ({ - audio: { - speech: { - create: mockCreate, + (OpenAI as any).mockImplementation(function () { + return { + audio: { + speech: { + create: mockCreate, + }, }, - }, - })); + }; + }); }); afterEach(() => { diff --git a/ui/litellm-dashboard/src/app/(dashboard)/playground/llm_calls/audio_transcriptions.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/playground/llm_calls/audio_transcriptions.test.tsx index 65b11e7f7d8..52561e5d42e 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/playground/llm_calls/audio_transcriptions.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/playground/llm_calls/audio_transcriptions.test.tsx @@ -16,13 +16,15 @@ describe("audio_transcription", () => { }); // Mock the OpenAI constructor and its methods - (OpenAI as any).mockImplementation(() => ({ - audio: { - transcriptions: { - create: mockCreate, + (OpenAI as any).mockImplementation(function () { + return { + audio: { + transcriptions: { + create: mockCreate, + }, }, - }, - })); + }; + }); }); afterEach(() => { diff --git a/ui/litellm-dashboard/src/components/llm_calls/chat_completion.test.tsx b/ui/litellm-dashboard/src/components/llm_calls/chat_completion.test.tsx index bc4b4e3a351..08b02cacb21 100644 --- a/ui/litellm-dashboard/src/components/llm_calls/chat_completion.test.tsx +++ b/ui/litellm-dashboard/src/components/llm_calls/chat_completion.test.tsx @@ -20,7 +20,9 @@ const mockClient = { vi.mock("openai", () => ({ default: { - OpenAI: vi.fn(() => mockClient), + OpenAI: vi.fn(function () { + return mockClient; + }), }, })); diff --git a/ui/litellm-dashboard/src/components/llm_calls/responses_api.test.tsx b/ui/litellm-dashboard/src/components/llm_calls/responses_api.test.tsx index 0b94c093acd..ae5e224cfbf 100644 --- a/ui/litellm-dashboard/src/components/llm_calls/responses_api.test.tsx +++ b/ui/litellm-dashboard/src/components/llm_calls/responses_api.test.tsx @@ -16,7 +16,9 @@ const mockClient = { vi.mock("openai", () => ({ default: { - OpenAI: vi.fn(() => mockClient), + OpenAI: vi.fn(function () { + return mockClient; + }), }, }));