mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-19 22:44:45 +00:00
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { formatCliParseErrorOutput } from "./error-output.js";
|
|
|
|
describe("formatCliParseErrorOutput", () => {
|
|
it("explains unknown commands with root help and plugin hints", () => {
|
|
const output = formatCliParseErrorOutput("error: unknown command 'wat'\n", {
|
|
argv: ["node", "openclaw", "wat"],
|
|
});
|
|
|
|
expect(output).toBe(
|
|
'OpenClaw does not know the command "wat".\nTry: openclaw --help\nPlugin command? openclaw plugins list\nDocs: https://docs.openclaw.ai/cli\n',
|
|
);
|
|
});
|
|
|
|
it("points unknown options at the active command help", () => {
|
|
const output = formatCliParseErrorOutput("error: unknown option '--wat'\n", {
|
|
argv: ["node", "openclaw", "channels", "status", "--wat"],
|
|
});
|
|
|
|
expect(output).toBe(
|
|
'OpenClaw does not recognize option "--wat".\nTry: openclaw channels status --help\n',
|
|
);
|
|
});
|
|
|
|
it("points missing required arguments at command help", () => {
|
|
const output = formatCliParseErrorOutput("error: missing required argument 'name'\n", {
|
|
argv: ["node", "openclaw", "plugins", "install"],
|
|
});
|
|
|
|
expect(output).toBe(
|
|
'Missing required argument "name".\nTry: openclaw plugins install --help\n',
|
|
);
|
|
});
|
|
});
|