Add test for stable snapshot between store updates

This commit is contained in:
2026-03-31 01:36:18 +02:00
parent 03ee9fab5a
commit 7988222e99

View File

@@ -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();