import "@testing-library/jest-dom/vitest"; import { cleanup, configure } from "@testing-library/react"; import { afterEach, vi } from "vitest"; import { usePresence } from "../src/platform/presence"; import { usePreferences } from "../src/state/preferences"; import { useToasts } from "../src/state/toasts"; afterEach(() => { cleanup(); // The board remembers what was seen per location (CR-008); start each test fresh. if (typeof localStorage !== "undefined") localStorage.clear(); // One-time tips (the skill point pop-up among them) are shown again in each test. usePreferences.setState({ dismissedTips: [] }); // Presence and toasts are module stores (CR-028): each test starts with neither. usePresence.setState({ here: true, hereSince: null, awaySince: null, lastReturn: null, returns: 0, }); useToasts.setState({ toasts: [] }); }); // findBy*/waitFor default to 1 s, which a busy parallel run can exceed; wait up to 3 s. configure({ asyncUtilTimeout: 3000 }); // PixiJS needs WebGL, which jsdom lacks. Component tests use a stand-in canvas; // the map's logic (projection, camera, scene, hit-testing) is unit-tested directly. vi.mock("../src/map/MapCanvas", () => import("./map-canvas-double"));