The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
Fix flaky tests due to antd Notification Manager (#16740)
yuneng-jiang54425eb57b13
diff --git a/ui/litellm-dashboard/src/components/molecules/notifications_manager.test.tsx b/ui/litellm-dashboard/src/components/molecules/notifications_manager.test.tsxindex c57c3052170..dabca71746b 100644--- a/ui/litellm-dashboard/src/components/molecules/notifications_manager.test.tsx+++ b/ui/litellm-dashboard/src/components/molecules/notifications_manager.test.tsx@@ -1,7 +1,15 @@-import { describe, it, expect, beforeEach, vi } from "vitest";import { notification } from "antd";+import { beforeEach, describe, expect, it, vi } from "vitest";import NotificationManager from "./notifications_manager";+vi.mock("@/components/molecules/notifications_manager", async () => {+ const actual = await vi.importActual<typeof import("@/components/molecules/notifications_manager")>(+ "@/components/molecules/notifications_manager",+ );++ return actual;+});+// Mock the antd notification modulevi.mock("antd", () => ({notification: {diff --git a/ui/litellm-dashboard/tests/setupTests.ts b/ui/litellm-dashboard/tests/setupTests.tsindex c21b70aec35..eb48ecc102b 100644--- a/ui/litellm-dashboard/tests/setupTests.ts+++ b/ui/litellm-dashboard/tests/setupTests.ts@@ -1,6 +1,20 @@import "@testing-library/jest-dom";-import { afterEach, vi } from "vitest";import { cleanup } from "@testing-library/react";+import { afterEach, vi } from "vitest";++// Global mock for NotificationManager to prevent React rendering issues in tests+// This avoids "window is not defined" errors when notifications try to render+// after test environment is torn down+vi.mock("@/components/molecules/notifications_manager", () => ({+ default: {+ success: vi.fn(),+ fromBackend: vi.fn(),+ error: vi.fn(),+ warning: vi.fn(),+ info: vi.fn(),+ clear: vi.fn(),+ },+}));afterEach(() => {cleanup();