import { describe, expect, test } from "bun:test"; import { createInitialAppState } from "@editor/initial-state"; import { workspaceSetPanelCommand } from "./workspace"; describe("workspace commands", () => { test.each(["generate", "chromaKey"] as const)("opens the %s operation without changing the persistent tool", (panel) => { const initial = createInitialAppState("Test"); const state = { ...initial, editor: { ...initial.editor, tools: { ...initial.editor.tools, activeTool: "brush" as const, interactionMode: { type: "tool" as const, tool: "brush" as const } }, brushPreview: { position: { x: 10, y: 20 } }, brushStrokePreview: { layerId: "layer", assetId: "asset", source: "preview" }, }, }; const next = workspaceSetPanelCommand.execute({ state }, { panel }); expect(next.editor.workspace.panel).toBe(panel); expect(next.editor.tools.activeTool).toBe("brush"); expect(next.editor.brushPreview).toBeUndefined(); expect(next.editor.brushStrokePreview).toBeUndefined(); }); });