fix(gate): buildArtifactGate emits approve/reject options so the gate renders a forward button
This commit is contained in:
@@ -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, []);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user