feat: implement updateTagTreeStatus function to manage tag status updates without mutating original tree

This commit is contained in:
mlogclub
2026-05-30 21:02:37 +08:00
parent 21ac67de5e
commit 6f05d1ebcc
3 changed files with 53 additions and 1 deletions
+11
View File
@@ -102,3 +102,14 @@ test("flattens only visible branches when a parent is collapsed", async () => {
JSON.stringify([1, 3])
)
})
test("updates a tag status in tree data without mutating the original tree", async () => {
const { updateTagTreeStatus } = await loadModule()
const nextTags = updateTagTreeStatus(tags, 2, 1)
assert.equal(tags[0].children[0].status, 0)
assert.equal(nextTags[0].children[0].status, 1)
assert.equal(nextTags[0].status, 0)
assert.equal(nextTags[1], tags[1])
})