import assert from "node:assert/strict"; import { describe, it } from "node:test"; import { buildSafetyPlanFeedback, buildSafetyStateFeedback } from "./safetyActionFeedback.ts"; describe("safetyActionFeedback", () => { it("describes finding state changes as metadata-only", () => { const feedback = buildSafetyStateFeedback("finding", "finding-1", "acknowledged"); assert.equal(feedback.tone, "success"); assert.match(feedback.description, /metadata-only/); assert.deepEqual(feedback.links[0], { label: "Open audit", href: "/audit?query=finding-1" }); }); it("links successful remediation plan creation to the non-executing plan", () => { const feedback = buildSafetyPlanFeedback("rec-1", { success: true, status: "plan_linked", href: "/ai/remediation-planner?plan=plan-1", executable: false, planId: "plan-1", }); assert.equal(feedback.tone, "success"); assert.match(feedback.description, /niet-uitvoerend/); assert.deepEqual(feedback.links, [ { label: "Open plan", href: "/ai/remediation-planner?plan=plan-1" }, { label: "Open audit", href: "/audit?query=plan-1" }, ]); }); it("warns if a future plan result ever reports executable true", () => { const feedback = buildSafetyPlanFeedback("rec-1", { success: true, status: "plan_linked", href: "/ai/remediation-planner?plan=plan-1", executable: true, planId: "plan-1", }); assert.equal(feedback.tone, "warning"); assert.match(feedback.description, /Controleer execution/); }); });