Files
fusion/plugins/fusion-plugin-compound-engineering/src/dashboard/test-setup.ts
gsxdsm 8bb459702c feat(compound-engineering): artifact hub view, discovery, read routes (U3)
Add allowlist-based artifact discovery over the conventional CE locations
(STRATEGY.md, docs/ideation, docs/brainstorms, docs/plans, docs/solutions,
CONCEPTS.md), grouped by stage, with error entries for unreadable artifacts and
no reads outside the allowlist. Add list/read/preview routes (self-contained
sandboxed HTML, data-section markers) and the primary CompoundEngineeringView
with explicit empty/partial/error states, viewport-gated fetch, and a short-TTL
cache. Bind the view via registerBundledPluginViews + dashboard workspace dep
(the real binding; manifest componentPath is cosmetic).
2026-06-02 19:25:54 -07:00

27 lines
932 B
TypeScript

import "@testing-library/jest-dom/vitest";
import { cleanup } from "@testing-library/react";
import { afterEach, vi } from "vitest";
// @testing-library/react only auto-registers cleanup when vitest globals are
// enabled. We don't enable globals here, so we wire it manually — otherwise
// React leaves the test tree mounted, its scheduler fires a deferred update
// via setImmediate after the jsdom environment is torn down, and the suite
// fails with "ReferenceError: window is not defined".
afterEach(() => cleanup());
if (typeof window !== "undefined") {
Object.defineProperty(window, "matchMedia", {
writable: true,
value: vi.fn().mockImplementation((query: string) => ({
matches: false,
media: query,
onchange: null,
addEventListener: vi.fn(),
removeEventListener: vi.fn(),
addListener: vi.fn(),
removeListener: vi.fn(),
dispatchEvent: vi.fn(),
})),
});
}