60 lines
2.4 KiB
TypeScript
60 lines
2.4 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { presentationWorkflowPlan } from "./workflow-graph-data.js";
|
|
|
|
describe("presentationWorkflowPlan", () => {
|
|
it("contains the canonical ten-node raw story without layout coordinates", () => {
|
|
expect(presentationWorkflowPlan.nodes.map((node) => node.id)).toEqual([
|
|
"reset_board",
|
|
"read_docs",
|
|
"analyze",
|
|
"build_report",
|
|
"draft_issues",
|
|
"review_issues",
|
|
"create_issues",
|
|
"finalise",
|
|
"revision_requested",
|
|
"end_completed",
|
|
]);
|
|
expect(presentationWorkflowPlan.nodes.every((node) => !("x" in node) && !("y" in node))).toBe(true);
|
|
expect(presentationWorkflowPlan.nodes.find((node) => node.id === "read_docs")?.node).toBe(
|
|
"local.lda_docs.read_documents",
|
|
);
|
|
expect(presentationWorkflowPlan.nodes.find((node) => node.id === "revision_requested")?.node).toBe(
|
|
"local.lda_report.record_revision_request",
|
|
);
|
|
expect(presentationWorkflowPlan.nodes.map((node) => node.id)).not.toContain("end_cancelled");
|
|
});
|
|
|
|
it("keeps submitted and cancelled branch labels factual", () => {
|
|
expect(presentationWorkflowPlan.edges.filter((edge) => edge.from === "review_issues")).toEqual([
|
|
{ from: "review_issues", to: "create_issues", outcome: "submitted" },
|
|
{ from: "review_issues", to: "revision_requested", outcome: "cancelled" },
|
|
]);
|
|
});
|
|
|
|
it("provides factual inspection contracts for every displayed node", () => {
|
|
for (const node of presentationWorkflowPlan.nodes) {
|
|
expect(node.capability, node.id).toBeTruthy();
|
|
expect(node.inputSummary, node.id).toBeTruthy();
|
|
expect(node.outputSummary, node.id).toBeTruthy();
|
|
expect(node.evidencePointer, node.id).toBeTruthy();
|
|
|
|
if (node.type !== "end") {
|
|
expect(node.outcomes, node.id).toEqual(
|
|
presentationWorkflowPlan.edges
|
|
.filter((edge) => edge.from === node.id)
|
|
.map((edge) => edge.outcome),
|
|
);
|
|
}
|
|
}
|
|
|
|
const interrupt = presentationWorkflowPlan.nodes.find((node) => node.id === "review_issues");
|
|
expect(interrupt?.schemaSummary).toMatch(/request: issue proposals/i);
|
|
expect(interrupt?.outcomes).toEqual(["submitted", "cancelled"]);
|
|
expect(presentationWorkflowPlan.nodes.find((node) => node.id === "finalise")?.outcomes).toEqual([
|
|
"completed",
|
|
]);
|
|
expect(presentationWorkflowPlan.nodes.find((node) => node.id === "revision_requested")?.outcomes).toEqual([]);
|
|
});
|
|
});
|