From 7988222e99fb499c733f7b0f9ca183902003fd01 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Tue, 31 Mar 2026 01:36:18 +0200 Subject: [PATCH] Add test for stable snapshot between store updates --- tests/domain/editor-store.test.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/domain/editor-store.test.ts b/tests/domain/editor-store.test.ts index 6349def5..e8f84480 100644 --- a/tests/domain/editor-store.test.ts +++ b/tests/domain/editor-store.test.ts @@ -22,6 +22,21 @@ class MemoryStorage implements KeyValueStorage { } describe("EditorStore", () => { + it("returns a stable snapshot between store updates", () => { + const store = createEditorStore(); + + const initialSnapshot = store.getState(); + const repeatedSnapshot = store.getState(); + + expect(repeatedSnapshot).toBe(initialSnapshot); + + store.executeCommand(createSetSceneNameCommand("Snapshot Scene")); + + const updatedSnapshot = store.getState(); + expect(updatedSnapshot).not.toBe(initialSnapshot); + expect(updatedSnapshot.document.name).toBe("Snapshot Scene"); + }); + it("applies command history with undo and redo", () => { const store = createEditorStore();