FN-6036: restore SettingsModal workflow-lane test cleanup
Restore the SettingsModal project models workflow-lane test setup so runs start from a clean browser state. - import and call testing-library cleanup after each test - reset timers, plugin UI slot cache, and browser storage in test hooks - unstub globals during teardown to prevent cross-test leakage Files changed: .../dashboard/app/components/__tests__/SettingsModal.test.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) Fusion-Task-Id: FN-6036 Fusion-Task-Lineage: 69976a8b-272f-43a4-b61e-538993f930c8
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
||||
import type { ComponentProps } from "react";
|
||||
import { render, screen, fireEvent, waitFor, within, act } from "@testing-library/react";
|
||||
import { render, screen, fireEvent, waitFor, within, act, cleanup } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { EditorView } from "@codemirror/view";
|
||||
import { SettingsModal } from "../SettingsModal";
|
||||
@@ -517,7 +517,10 @@ describe("SettingsModal", () => {
|
||||
|
||||
|
||||
beforeEach(() => {
|
||||
vi.useRealTimers();
|
||||
vi.clearAllMocks();
|
||||
localStorage.clear();
|
||||
sessionStorage.clear();
|
||||
clearPluginUiSlotsCache();
|
||||
mockUseMobileKeyboard.mockReturnValue({
|
||||
keyboardOpen: false,
|
||||
@@ -762,6 +765,12 @@ describe("SettingsModal", () => {
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
cleanup();
|
||||
clearPluginUiSlotsCache();
|
||||
localStorage.clear();
|
||||
sessionStorage.clear();
|
||||
vi.useRealTimers();
|
||||
vi.unstubAllGlobals();
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user