import { describe, expect, it } from "vitest"; import { CAD_MODIFIER_MAX_SHARP_ANGLE, CAD_MODIFIER_REQUEST_TIMEOUT_MS, CAD_MODIFIER_RUNTIME_BASE, cadModifierTimeoutMessage, edgeModifierSelectionStatus, } from "@/lib/cadModifierRuntime"; describe("CAD modifier runtime state", () => { it("uses the build-managed OCCT runtime", () => { expect(CAD_MODIFIER_RUNTIME_BASE).toBe("/occt"); }); it("does not report zero edges before preparation finishes", () => { expect(edgeModifierSelectionStatus(false, 0, 0)).toBe("Preparing edges\u2026"); expect(edgeModifierSelectionStatus(true, 0, 0)).toBe("0 of 0 sharp edges selected"); expect(edgeModifierSelectionStatus(true, 2, 12)).toBe("2 of 12 sharp edges selected"); }); it("sets a bounded preparation wait and an actionable compatibility error", () => { expect(CAD_MODIFIER_REQUEST_TIMEOUT_MS).toBeGreaterThanOrEqual(20_000); expect(CAD_MODIFIER_REQUEST_TIMEOUT_MS).toBeLessThanOrEqual(60_000); expect(cadModifierTimeoutMessage("prepare")).toContain("Firefox 121+"); }); it("does not expose thresholds above the worker's folded edge-angle range", () => { expect(CAD_MODIFIER_MAX_SHARP_ANGLE).toBe(90); }); });