Stage 2 of the int-suite speedup: pool=forks with fileParallelism and a default cap of 8 (VITEST_MAX_FORKS), each fork cloning the template into ptf_*_test_w<ID> via tests/vitest-worker-setup.ts; environment defaults to node with jsdom opt-in docblocks on the six DOM-consuming specs; a tiny reporter writes a failure marker so post-run cleanup keeps clones after red runs (KEEP_TEST_DBS=1 forces keeping); pg pools cap at TEST_PG_POOL_MAX=3 per boot in workers mode. Legacy serial mode stays reachable by setting TEST_DATABASE_URI. Notes from the gate G2 runs (Vitest 4.0.16): globalTeardown config was removed in Vitest 4 entirely - cleanup now returns from globalSetup. The pool scheduler only reuses worker processes when isolate:false, so this per-file-fork stage lands short of the wall-time target and is expected to be superseded by the gated isolate:false stage. Gate G2 warm serial equivalent stays green via TEST_DATABASE_URI bisect mode.
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
// @vitest-environment jsdom
|
|
import { createElement } from "react";
|
|
import { cleanup, render, screen } from "@testing-library/react";
|
|
import { afterEach, describe, expect, it } from "vitest";
|
|
import { MissionCard } from "@/components/frontend/intelligence/MissionCard";
|
|
|
|
const mission = {
|
|
id: 1,
|
|
name: "Operation Nightfall",
|
|
codeName: "OP:NIGHTFALL",
|
|
summary: "Secure the extraction corridor.",
|
|
operationType: "main" as const,
|
|
classification: {
|
|
missionType: "PvE" as const,
|
|
startDateTime: "2026-08-20T19:30:00.000Z",
|
|
estimatedDuration: 90,
|
|
map: 2,
|
|
campaign: 3,
|
|
},
|
|
ownershipAndStatus: {
|
|
status: "Scheduled" as const,
|
|
},
|
|
missionRoles: {
|
|
maxPlayers: 12,
|
|
},
|
|
coverImage: {
|
|
id: 8,
|
|
updatedAt: "2026-08-20T00:00:00.000Z",
|
|
createdAt: "2026-08-20T00:00:00.000Z",
|
|
url: "/media/nightfall.webp",
|
|
},
|
|
};
|
|
|
|
describe("MissionCard", () => {
|
|
afterEach(() => {
|
|
cleanup();
|
|
});
|
|
|
|
it("uses the cover image by default and keeps full metadata visible", () => {
|
|
render(createElement(MissionCard, { mission, showFullDetails: true }));
|
|
|
|
const image = document.querySelector("img");
|
|
expect(image?.getAttribute("src")).toBe("/media/nightfall.webp");
|
|
expect(screen.getByText("1h 30m")).toBeTruthy();
|
|
expect(screen.getByText("12 slots")).toBeTruthy();
|
|
});
|
|
|
|
it("suppresses the cover image when the default variant is requested", () => {
|
|
render(createElement(MissionCard, { mission, variant: "default" }));
|
|
|
|
expect(document.querySelector("img")).toBeNull();
|
|
});
|
|
});
|