mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-25 21:49:32 +00:00
28 lines
952 B
TypeScript
28 lines
952 B
TypeScript
// Argv invocation tests cover CLI argv normalization before command dispatch.
|
|
import { describe, expect, it } from "vitest";
|
|
import { resolveCliArgvInvocation } from "./argv-invocation.js";
|
|
|
|
describe("argv-invocation", () => {
|
|
it("resolves root help and empty command path", () => {
|
|
expect(resolveCliArgvInvocation(["node", "openclaw", "--help"])).toEqual({
|
|
argv: ["node", "openclaw", "--help"],
|
|
commandPath: [],
|
|
primary: null,
|
|
hasHelpOrVersion: true,
|
|
isRootHelpInvocation: true,
|
|
});
|
|
});
|
|
|
|
it("resolves command path and primary with root options", () => {
|
|
expect(
|
|
resolveCliArgvInvocation(["node", "openclaw", "--profile", "work", "gateway", "status"]),
|
|
).toEqual({
|
|
argv: ["node", "openclaw", "--profile", "work", "gateway", "status"],
|
|
commandPath: ["gateway", "status"],
|
|
primary: "gateway",
|
|
hasHelpOrVersion: false,
|
|
isRootHelpInvocation: false,
|
|
});
|
|
});
|
|
});
|