import { describe, expect, it } from "vitest"; import type { ToolcraftPerformancePath } from "./performance-path-model"; import { getToolcraftPerformanceProfileErrors } from "./performance-profile-validation"; function path( interaction: ToolcraftPerformancePath["interaction"], profile: ToolcraftPerformancePath["profile"], ): ToolcraftPerformancePath { return { id: `performance-path:${interaction}`, interaction, invalidates: [], profile, runsOn: [], targets: [], workloadDimensions: [], }; } describe("Toolcraft performance profile validation", () => { it("accepts the runtime-derived profile for each interaction", () => { expect( getToolcraftPerformanceProfileErrors([ path("control-drag", "interactive-continuous"), path("control-change", "interactive-discrete"), path("export", "batch-responsive"), path("initial-render", "initial-render"), ]), ).toEqual([]); }); it("rejects product-authored profile substitution", () => { expect( getToolcraftPerformanceProfileErrors([ path("control-drag", "batch-responsive"), ]), ).toEqual([ 'Performance path "performance-path:control-drag" interaction control-drag requires central profile interactive-continuous, received batch-responsive.', ]); }); });