A3: derive the pinned command and catalog key lists in tests

Each command module keeps its own COMMAND_IDS next to its commands; the
engine listing test checks their union against the registry, so a missing
or extra command still fails without one shared list. The menu and palette
tests derive their expectation from the listing and check grouping and
ordering rules; the catalog's runtime keys are scanned from the sources.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-10-30 18:38:41 +01:00
parent da58c83158
commit 95fd9b926f
28 changed files with 329 additions and 262 deletions

View file

@ -257,49 +257,14 @@ describe("CommandPalette", () => {
await press(PALETTE_KEY);
expect(wrapper.find("[data-test=palette]").exists()).toBe(true);
expect(document.activeElement).toBe(wrapper.find("[data-test=palette-input]").element);
expect(rows(wrapper)).toEqual([
"vcs.abortMerge",
"vcs.toggleBlame",
"vcs.branches",
"vcs.openChanges",
"vcs.checkout",
"vcs.clone",
"project.close",
"palette.open",
"vcs.commit",
"editor.complete",
"vcs.fetch",
"find.open",
"goto.classOpen",
"goto.fileOpen",
"goto.symbolOpen",
"vcs.showLog",
"vcs.manageRemotes",
"vcs.merge",
"vcs.newBranch",
"vcs.nextChange",
"project.openDialog",
"menu.open",
"editor.parameterInfo",
"vcs.previousChange",
"problems.open",
"vcs.pull",
"vcs.push",
"editor.quickDocumentation",
"app.quit",
"vcs.refresh",
"vcs.resolveConflicts",
"editor.reveal",
"settings.open",
"vcs.showCommit",
"vcs.showDiff",
"vcs.showHistory",
"view.toggleProjectTree",
"view.toggleStructure",
"vcs.stash",
"vcs.showStashes",
"terminal.open",
]);
const offered = (listing() as { id: string; menuPath: string | null; defaultShortcut: string | null; ui: boolean }[])
.filter((c) => c.ui || c.menuPath !== null || c.defaultShortcut !== null)
.map((c) => c.id);
expect(offered).toContain("palette.open");
expect(offered).not.toContain("buffer.edit");
expect([...rows(wrapper)].sort()).toEqual([...offered].sort());
const labels = wrapper.findAll("[data-test=palette-row] .palette__label").map((label) => label.text());
expect(labels).toEqual([...labels].sort((x, y) => x.localeCompare(y)));
const quit = wrapper.find("[data-command='app.quit']");
expect(quit.find("[data-test=palette-shortcut]").text()).toBe("Ctrl+Q");
expect(quit.text()).toContain("Quit");