test(org): a definition a workflow names can still be removed (starter packs SP3 review P2)
This commit is contained in:
1 parent
2af12340ae
commit
9cfb5f64fe
1 file changed
+23
-1
@@ -100,6 +100,28 @@ test("SP3 a workflow naming a role that does not exist still loads (the load che
|
||||
assert.deepEqual(load(f, { ...f.document, projects: { stack: { ...f.document.projects.stack, workflows: ghost } } }).projects.stack.workflows, ghost);
|
||||
});
|
||||
|
||||
test("SP3 a definition a workflow names can still be removed, and the file then still loads", (t) => {
|
||||
// Design c0a60ed3a SP3 acceptance: "an org file whose step names a definition removed since loads,
|
||||
// and removing that definition succeeds".
|
||||
const f = fixture(t);
|
||||
const scouting = { scouting: { steps: [{ title: "Scout", state: "todo", roles: ["scout", "human"] }] } };
|
||||
const packs = { ...packPlan().packs, proposedHires: [] };
|
||||
f.writer.applyPack("acme", { definitions: { scout: PLAIN }, workflows: scouting, packs }, { revision: rev(f), actor: "jason", assertClean });
|
||||
f.writer.applyPack("acme", { "projects.stack.workflows": scouting }, { revision: rev(f), actor: "jason" });
|
||||
assert.deepEqual(doc(f).definitions.scout, { ...PLAIN, rev: 1 });
|
||||
f.writer.setDefinition("acme", "scout", () => null, { revision: rev(f), actor: "jason", assertClean });
|
||||
const after = doc(f);
|
||||
assert.equal(after.definitions?.scout, undefined);
|
||||
assert.deepEqual(after.workflows, scouting);
|
||||
assert.deepEqual(after.projects.stack.workflows, scouting);
|
||||
const loaded = load(f, after);
|
||||
assert.deepEqual(loaded.workflows, scouting);
|
||||
assert.deepEqual(loaded.projects.stack.workflows, scouting);
|
||||
// The writer reads it back too; only a new write of that workflow resolves its roles again.
|
||||
assert.equal(f.writer.read("acme").revision, rev(f));
|
||||
assert.throws(() => f.writer.applyPack("acme", { workflows: { again: scouting.scouting } }, { revision: rev(f), actor: "jason" }), { code: "invalid-request" });
|
||||
});
|
||||
|
||||
test("SP3 each invalid shape refuses", (t) => {
|
||||
const f = fixture(t);
|
||||
const col = (i, patch) => ({ ...BOARD, columns: BOARD.columns.map((c, j) => (j === i ? { ...c, ...patch } : c)) });
|
||||
@@ -362,7 +384,7 @@ test("SP3 a pack apply only adds, and its scope fences the project keys", (t) =>
|
||||
assert.deepEqual(doc(f).projects.stack.board, BOARD);
|
||||
});
|
||||
|
||||
test("SP3 the generic writer and setDefinition still refuse project board changes", (t) => {
|
||||
test("SP3 the generic writer still refuses project board changes", (t) => {
|
||||
const f = fixture(t);
|
||||
const next = structuredClone(f.document);
|
||||
next.projects.stack.board = BOARD;
|
||||
|
||||
Reference in new issue
Block a user