mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 10:31:37 +00:00
test(refactor): dedupe preaction command coverage
This commit is contained in:
@@ -183,24 +183,21 @@ describe("registerPreActionHooks", () => {
|
|||||||
expect(ensurePluginRegistryLoadedMock).toHaveBeenCalledTimes(1);
|
expect(ensurePluginRegistryLoadedMock).toHaveBeenCalledTimes(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("loads plugin registry for configure/onboard/agents commands", async () => {
|
it("loads plugin registry for configure command", async () => {
|
||||||
const commands = ["configure", "onboard", "agents"] as const;
|
const program = buildProgram(["configure"]);
|
||||||
const program = buildProgram(["configure", "onboard", "agents"]);
|
await runCommand(
|
||||||
for (const command of commands) {
|
{
|
||||||
vi.clearAllMocks();
|
parseArgv: ["configure"],
|
||||||
await runCommand(
|
processArgv: ["node", "openclaw", "configure"],
|
||||||
{
|
},
|
||||||
parseArgv: [command],
|
program,
|
||||||
processArgv: ["node", "openclaw", command],
|
);
|
||||||
},
|
|
||||||
program,
|
expect(ensurePluginRegistryLoadedMock).toHaveBeenCalledTimes(1);
|
||||||
);
|
|
||||||
expect(ensurePluginRegistryLoadedMock, command).toHaveBeenCalledTimes(1);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("skips config guard for doctor, completion, and secrets commands", async () => {
|
it("skips config guard for doctor command", async () => {
|
||||||
const program = buildProgram(["doctor", "completion", "secrets"]);
|
const program = buildProgram(["doctor"]);
|
||||||
await runCommand(
|
await runCommand(
|
||||||
{
|
{
|
||||||
parseArgv: ["doctor"],
|
parseArgv: ["doctor"],
|
||||||
@@ -208,20 +205,6 @@ describe("registerPreActionHooks", () => {
|
|||||||
},
|
},
|
||||||
program,
|
program,
|
||||||
);
|
);
|
||||||
await runCommand(
|
|
||||||
{
|
|
||||||
parseArgv: ["completion"],
|
|
||||||
processArgv: ["node", "openclaw", "completion"],
|
|
||||||
},
|
|
||||||
program,
|
|
||||||
);
|
|
||||||
await runCommand(
|
|
||||||
{
|
|
||||||
parseArgv: ["secrets"],
|
|
||||||
processArgv: ["node", "openclaw", "secrets"],
|
|
||||||
},
|
|
||||||
program,
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(ensureConfigReadyMock).not.toHaveBeenCalled();
|
expect(ensureConfigReadyMock).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user