From 83017be686fe3a0dcf969c95138677048b33edab Mon Sep 17 00:00:00 2001 From: Danila Poyarkov Date: Wed, 2 Sep 2026 10:25:25 +0300 Subject: [PATCH] test(scene-graph): assert rejected inserts preserve tree --- packages/scene-graph/src/mutation-impact.test.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/scene-graph/src/mutation-impact.test.ts b/packages/scene-graph/src/mutation-impact.test.ts index 79f450115..47f1a1d7e 100644 --- a/packages/scene-graph/src/mutation-impact.test.ts +++ b/packages/scene-graph/src/mutation-impact.test.ts @@ -81,11 +81,18 @@ describe('scene mutation impact', () => { const { graph, left, child } = transferSetup() const grandchild = graph.createNode('FRAME', child.id) + const originalPageChildren = [...(graph.getNode(pageId(graph))?.childIds ?? [])] + const originalLeftChildren = [...left.childIds] + const originalLeftParentId = left.parentId + const originalChildParentId = child.parentId + graph.insertChildAt(left.id, left.id, 0) graph.insertChildAt(left.id, grandchild.id, 0) - expect(left.parentId).toBe(pageId(graph)) - expect(graph.getNode(pageId(graph))?.childIds).toContain(left.id) + expect(left.parentId).toBe(originalLeftParentId) + expect(left.childIds).toEqual(originalLeftChildren) + expect(child.parentId).toBe(originalChildParentId) + expect(graph.getNode(pageId(graph))?.childIds).toEqual(originalPageChildren) expect(grandchild.childIds).not.toContain(left.id) })