fix(gate): buildArtifactGate emits approve/reject options so the gate renders a forward button

This commit is contained in:
2026-07-02 18:27:11 +02:00
parent 541df01684
commit 2633b46199
2 changed files with 34 additions and 0 deletions
@@ -159,3 +159,28 @@ test("artifact-gate with unknown action kind throws clearly", () => {
/action/i,
);
});
test("buildArtifactGate derives approve/reject options from action.kind", () => {
const w = buildArtifactGate({
id: "u1",
phase: "F1",
title: "Chiudi fase",
artifact: { kind: "phase", data: {} },
action: { kind: "approve_reject" },
});
assert.deepEqual(w.options, [
{ id: "approve", label: "Conferma e prosegui", recommended: true },
{ id: "reject", label: "Rifiuta" },
]);
});
test("buildArtifactGate: confirm -> single approve; view_only -> no options", () => {
const confirm = buildArtifactGate({
id: "u1", phase: "F1", title: "t", artifact: { kind: "phase", data: {} }, action: { kind: "confirm" },
});
assert.deepEqual(confirm.options, [{ id: "approve", label: "Conferma e prosegui", recommended: true }]);
const viewOnly = buildArtifactGate({
id: "u1", phase: "F1", title: "t", artifact: { kind: "phase", data: {} }, action: { kind: "view_only" },
});
assert.deepEqual(viewOnly.options, []);
});