test(FN-4493): complete Step 4 — add template parser interop tests

Fusion-Task-Id: FN-4493
Fusion-Task-Lineage: 966c7c55-fd51-4263-9d4e-87e9d06bfb6f
This commit is contained in:
Fusion
2026-05-14 12:05:09 -07:00
committed by gsxdsm
parent 88ea706508
commit 8c53517ce5

View File

@@ -0,0 +1,30 @@
import { WORKFLOW_STEP_TEMPLATES } from "@fusion/core";
import { describe, expect, it } from "vitest";
import { inferWorkflowStepVerdictFromProse, parseWorkflowStepVerdict } from "../executor.js";
const TARGET_TEMPLATE_IDS = [
"documentation-review",
"qa-check",
"security-audit",
"performance-review",
"accessibility-check",
"browser-verification",
"frontend-ux-design",
] as const;
describe("workflow step template verdict interoperability", () => {
it.each(TARGET_TEMPLATE_IDS)("%s supports canonical JSON and prose fallback", (id) => {
const template = WORKFLOW_STEP_TEMPLATES.find((entry) => entry.id === id);
expect(template).toBeTruthy();
expect(parseWorkflowStepVerdict('{"verdict":"APPROVE","notes":""}')).toEqual({ verdict: "APPROVE", notes: "" });
expect(parseWorkflowStepVerdict('{"verdict":"APPROVE","notes":"out of scope: no UI files changed"}')).toEqual({
verdict: "APPROVE",
notes: "out of scope: no UI files changed",
});
expect(inferWorkflowStepVerdictFromProse("REQUEST REVISION\nfix packages/foo.ts")).toEqual({
verdict: "REVISE",
notes: "fix packages/foo.ts",
});
});
});