refactor(commands): centralize command ids
This commit is contained in:
@@ -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 });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user