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 unhandled "window is not defined" error in user_edit_view tests
Yuneng Jianga771e1939ce0
diff --git a/ui/litellm-dashboard/src/components/user_edit_view.test.tsx b/ui/litellm-dashboard/src/components/user_edit_view.test.tsxindex 7f78ef45127..7aeaae94fab 100644--- a/ui/litellm-dashboard/src/components/user_edit_view.test.tsx+++ b/ui/litellm-dashboard/src/components/user_edit_view.test.tsx@@ -1,6 +1,6 @@-import { screen, waitFor } from "@testing-library/react";+import { cleanup, screen, waitFor } from "@testing-library/react";import userEvent from "@testing-library/user-event";-import { beforeEach, describe, expect, it, vi } from "vitest";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import { renderWithProviders } from "../../tests/test-utils";import { UserEditView } from "./user_edit_view";@@ -140,6 +140,15 @@ describe("UserEditView", () => {vi.clearAllMocks();});+ afterEach(() => {+ // Tremor's internal Tooltip sets a setTimeout that fires after teardown,+ // causing "window is not defined". Flush pending timers before cleanup.+ vi.useFakeTimers();+ vi.runAllTimers();+ vi.useRealTimers();+ cleanup();+ });+it("should render", async () => {renderWithProviders(<UserEditView {...defaultProps} />);