FN-5753: remove global CSS fixture from PrCreateModal behavioral test
Speed up the PrCreateModal behavioral test by removing unnecessary global CSS setup. - Drop beforeAll/afterAll style injection using loadAllAppCss in PrCreateModal.test.tsx - Remove now-unused vitest lifecycle imports (beforeAll/afterAll) - Keep test behavior intact while reducing setup overhead Files changed: .../app/components/__tests__/PrCreateModal.test.tsx | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) Fusion-Task-Id: FN-5753 Fusion-Task-Lineage: 9689c0d2-9ed9-4bf7-b702-6ff4b6677bef
This commit is contained in:
@@ -1,9 +1,8 @@
|
|||||||
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
|
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
|
||||||
import type { ComponentProps } from "react";
|
import type { ComponentProps } from "react";
|
||||||
import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
import { PrCreateModal } from "../PrCreateModal";
|
import { PrCreateModal } from "../PrCreateModal";
|
||||||
import type { PrInfo } from "@fusion/core";
|
import type { PrInfo } from "@fusion/core";
|
||||||
import { loadAllAppCss } from "../../test/cssFixture";
|
|
||||||
|
|
||||||
const mocks = vi.hoisted(() => ({
|
const mocks = vi.hoisted(() => ({
|
||||||
generatePrMetadata: vi.fn(),
|
generatePrMetadata: vi.fn(),
|
||||||
@@ -61,18 +60,6 @@ async function renderModalLoaded(overrides?: Partial<ComponentProps<typeof PrCre
|
|||||||
}
|
}
|
||||||
|
|
||||||
describe("PrCreateModal", () => {
|
describe("PrCreateModal", () => {
|
||||||
let styleEl: HTMLStyleElement;
|
|
||||||
|
|
||||||
beforeAll(() => {
|
|
||||||
styleEl = document.createElement("style");
|
|
||||||
styleEl.textContent = loadAllAppCss();
|
|
||||||
document.head.appendChild(styleEl);
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(() => {
|
|
||||||
styleEl.remove();
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
|
|||||||
Reference in New Issue
Block a user