mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-06 02:48:13 +00:00
Fix unhandled "window is not defined" error in user_edit_view tests
Tremor's internal Tooltip component sets a setTimeout that fires after the jsdom test environment tears down, causing a ReferenceError. Add afterEach that flushes pending timers before cleanup.
This commit is contained in:
parent
9e6d2d2069
commit
a771e1939c
1 changed files with 11 additions and 2 deletions
|
|
@ -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} />);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue