Skip to content

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]

Mock tremor's tooltip to fix flaky tests (#16786)

yuneng-jiang7b9c40976081
diff --git a/ui/litellm-dashboard/tests/setupTests.ts b/ui/litellm-dashboard/tests/setupTests.ts
index eb48ecc102b..fdb3dea36e7 100644
--- a/ui/litellm-dashboard/tests/setupTests.ts
+++ b/ui/litellm-dashboard/tests/setupTests.ts
@@ -1,5 +1,6 @@
import "@testing-library/jest-dom";
import { cleanup } from "@testing-library/react";
+import React from "react";
import { afterEach, vi } from "vitest";
// Global mock for NotificationManager to prevent React rendering issues in tests
@@ -16,6 +17,18 @@ vi.mock("@/components/molecules/notifications_manager", () => ({
},
}));
+vi.mock("@tremor/react", async (importOriginal) => {
+ const actual = await importOriginal<typeof import("@tremor/react")>();
+ return {
+ ...actual,
+ Tooltip: ({ children, ..._props }: { children?: React.ReactNode; [key: string]: unknown }) => {
+ // Return children directly without tooltip functionality to prevent flaky tests
+ // This avoids issues with hover states, positioning, and DOM queries in tests
+ return React.createElement(React.Fragment, null, children);
+ },
+ };
+});
+
afterEach(() => {
cleanup();
});