/** * CAD 명령 목록 거울(PLAN 332-2) — `commands/command-catalog.json` 이 registry(`commands.*.ts`)와 같은지. * ☰ [설정] CAD 단축키 탭은 xstate 가 딸려 오지 않게 JSON 만 읽음 — 명령을 더하거나 별칭을 바꾸면 JSON 도 같이. * 실행: cd B07_DesignDetail/openwebcad && npx vitest run --dir ../../resources/tester/cad command-catalog */ import { describe, expect, it } from "vitest"; import catalog from "../../../B07_DesignDetail/openwebcad/src/commands/command-catalog.json"; import { getAllCommands } from "../../../B07_DesignDetail/openwebcad/src/commands/registry"; describe("command-catalog.json", () => { it("registry 와 같은 명령 · 한글 이름 · 기본 별칭 · 차례", () => { const live = getAllCommands().map((c) => ({ id: c.id, label: c.label, aliases: c.aliases ?? [], })); expect(catalog).toEqual(live); }); it("기본 별칭 = 영문 · 숫자 · 안 겹침 · 명령 이름과 다름", () => { const ids = new Set(catalog.map((c) => c.id)); const aliases = catalog.flatMap((c) => c.aliases); expect(aliases.every((a) => /^[A-Z0-9]+$/.test(a))).toBe(true); expect(new Set(aliases).size).toBe(aliases.length); expect(aliases.filter((a) => ids.has(a))).toEqual([]); }); it("337 acad.pgp 맞춤 — SE 없음(acad = DSETTINGS) · ED = TEXTEDIT", () => { const owner = (alias: string) => catalog.find((c) => c.aliases.includes(alias))?.id; expect(owner("SE")).toBeUndefined(); expect(owner("ED")).toBe("TEXTEDIT"); }); });