// The verdict-proposed rows (release 29 M8): one per waiting proposal, one // card's words, in the Review group with its one action. import { test } from "node:test"; import assert from "node:assert/strict"; import { unreadableProposalsDecision, verdictsDecisions, verdictsWhy } from "./verdicts.mjs"; import { annotate, groupOf, summarizeGroups } from "./groups.mjs"; import { whatOf } from "./what.mjs"; test("verdict-proposed: a row per proposal, the card's words, the Review group, Review verdicts", () => { const waiting = [ { claim: "c2", model: "qwen3:8b", promptVersion: "2", at: "2026-10-15T10:00:00Z" }, { claim: "c4", model: "qwen3:8b", promptVersion: "2", at: "2026-10-15T11:00:00Z" }, ]; const rows = verdictsDecisions({ base: { project: "sites/articles/fc", projectKind: "article", projectTitle: "A check", piece: "a:articles/fc" }, href: "/articles/fc?tab=article", waiting }); assert.equal(rows.length, 2); assert.ok(rows.every((r) => r.kind === "verdict-proposed" && r.severity === "open" && r.what === "2 verdicts proposed" && r.href === "/articles/fc?tab=article")); assert.deepEqual(rows.map((r) => r.target), ["c2", "c4"]); assert.equal(rows[0].at, Date.parse("2026-10-15T11:00:00Z")); assert.equal(verdictsWhy(waiting), "2 verdicts proposed · by qwen3:8b · prompt v2"); assert.equal(groupOf(rows[0]), "review"); assert.equal(whatOf("verdict-proposed"), "verdicts proposed"); const annotated = annotate(rows, { pieceOf: () => "a:articles/fc", lifecycleOf: () => "active", isMuted: () => false }); assert.equal(annotated[0].action.label, "Review verdicts"); const review = summarizeGroups(annotated).find((g) => g.id === "review"); assert.equal(review.cards.length, 1); assert.equal(review.cards[0].count, 2); assert.equal(review.cards[0].what, "2 verdicts proposed"); assert.deepEqual(verdictsDecisions({ base: { project: "x", projectTitle: "x" }, href: "/", waiting: [] }), []); }); test("unreadable-proposals: one Blocking row, its action the repair", () => { const d = unreadableProposalsDecision({ base: { project: "sites/articles/fc", projectTitle: "A check", piece: "a:articles/fc" }, href: "/articles/fc?tab=article", error: "unparseable", at: 5 }); assert.equal(d.kind, "unreadable-proposals"); assert.equal(groupOf(d), "blocking"); assert.match(d.why, /does not read \(unparseable\)/); const [a] = annotate([d], { pieceOf: () => "a:articles/fc", lifecycleOf: () => "active", isMuted: () => false }); assert.equal(a.action.label, "Repair verdicts.proposed.json"); assert.equal(whatOf("unreadable-proposals"), "verdicts.proposed.json does not read"); });