Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: a todo switched from clear to upsert drops its prefix flag

This commit is contained in:
iris 2026-10-24 14:05:02 +02:00 • committed by mara
commit fb8aa23e66
5 changed files with 34 additions and 12 deletions

View file

@ -21,6 +21,7 @@ import {
subtreeIds,
withFlow,
withoutFlow,
withOp,
} from "../src/pages/notifications/FlowDraft.ts";
const todo = (id) => ({
@ -156,6 +157,16 @@ test("replaceNode keeps the place and the kind class", () => {
assert.equal(replaceNode(f, todo("nope")).ok, false);
});
test("withOp drops what the new op has no place for", () => {
const clearing = { ...todo("t"), op: "clear", prefix: true, text: "" };
const up = withOp(clearing, "upsert");
assert.equal(up.op, "upsert");
assert.equal(up.prefix, false, "only a clear may be a prefix");
const back = withOp({ ...todo("t"), prefix: false }, "clear");
assert.equal(back.text, "", "a clear carries no text");
assert.equal(withOp(clearing, "clear").prefix, true, "kept on a clear");
});
test("new ids do not collide", () => {
const f = flow();
assert.equal(newNodeId(f, "match"), "match1");