From 94e480f64af76340b891902c96f90cd767ac2a40 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 2 Mar 2026 11:41:40 +0000 Subject: [PATCH] test(refactor): dedupe preaction command coverage --- src/cli/program/preaction.test.ts | 43 ++++++++++--------------------- 1 file changed, 13 insertions(+), 30 deletions(-) diff --git a/src/cli/program/preaction.test.ts b/src/cli/program/preaction.test.ts index a83b77c05..3d629f422 100644 --- a/src/cli/program/preaction.test.ts +++ b/src/cli/program/preaction.test.ts @@ -183,24 +183,21 @@ describe("registerPreActionHooks", () => { expect(ensurePluginRegistryLoadedMock).toHaveBeenCalledTimes(1); }); - it("loads plugin registry for configure/onboard/agents commands", async () => { - const commands = ["configure", "onboard", "agents"] as const; - const program = buildProgram(["configure", "onboard", "agents"]); - for (const command of commands) { - vi.clearAllMocks(); - await runCommand( - { - parseArgv: [command], - processArgv: ["node", "openclaw", command], - }, - program, - ); - expect(ensurePluginRegistryLoadedMock, command).toHaveBeenCalledTimes(1); - } + it("loads plugin registry for configure command", async () => { + const program = buildProgram(["configure"]); + await runCommand( + { + parseArgv: ["configure"], + processArgv: ["node", "openclaw", "configure"], + }, + program, + ); + + expect(ensurePluginRegistryLoadedMock).toHaveBeenCalledTimes(1); }); - it("skips config guard for doctor, completion, and secrets commands", async () => { - const program = buildProgram(["doctor", "completion", "secrets"]); + it("skips config guard for doctor command", async () => { + const program = buildProgram(["doctor"]); await runCommand( { parseArgv: ["doctor"], @@ -208,20 +205,6 @@ describe("registerPreActionHooks", () => { }, program, ); - await runCommand( - { - parseArgv: ["completion"], - processArgv: ["node", "openclaw", "completion"], - }, - program, - ); - await runCommand( - { - parseArgv: ["secrets"], - processArgv: ["node", "openclaw", "secrets"], - }, - program, - ); expect(ensureConfigReadyMock).not.toHaveBeenCalled(); });