refactor(commands): centralize command ids

This commit is contained in:
syntaxbullet
2026-07-03 11:31:02 +02:00
parent 8320203f11
commit 84a610f019
15 changed files with 66 additions and 38 deletions

View File

@@ -1,6 +1,7 @@
import { describe, expect, test } from "bun:test";
import { createInitialAppState } from "@editor/initial-state";
import { createAppStore } from "@editor/store";
import { commandIds } from "./ids";
import { createCommandRegistry } from "./registry";
import { viewportPanCommand } from "./viewport";
@@ -12,7 +13,7 @@ describe("command dispatcher", () => {
test("dispatch applies command result to store", () => {
const store = createAppStore(createInitialAppState("Test"), createCommandRegistry([viewportPanCommand]));
store.dispatch("viewport.pan", { delta: { x: 3, y: 7 } });
store.dispatch(commandIds.viewportPan, { delta: { x: 3, y: 7 } });
expect(store.getState().editor.viewport.center).toEqual({ x: 3, y: 7 });
});
});