fix(ui): restoring shipped workflows keeps custom ones

This commit is contained in:
sam committed 2026-10-05 20:27:38 +11:00
1 parent 22b23f78cf
commit a5b7b9232c
4 files changed
+98 -73

No files matched your search

+15
View File
@@ -5,6 +5,7 @@ import {
commandBody,
resourcesForPage,
upsertWorkflowDefinition,
restoreShippedDefinitions,
removeWorkflowDefinition,
applyStatusForKind,
} from "../src/stores/control-plane.ts";
@@ -124,6 +125,20 @@ test("workflow edits replace by id without dropping sibling definitions", () =>
assert.deepEqual(removeWorkflowDefinition(original, "implement"), {
definitions: [{ id: "tdd", yaml: "id: tdd\nsteps: []\n" }],
});
// Restoring shipped resets shipped ids and keeps a custom workflow.
assert.deepEqual(
restoreShippedDefinitions(
{ definitions: [...original.definitions, { id: "mine", yaml: "id: mine\n" }] },
{ definitions: [{ id: "implement", yaml: "shipped\n" }] },
),
{
definitions: [
{ id: "implement", yaml: "shipped\n" },
{ id: "tdd", yaml: "id: tdd\nsteps: []\n" },
{ id: "mine", yaml: "id: mine\n" },
],
},
);
});
test("apply status names a process behind the stored version and one that stopped reporting", () => {