test(cli): consolidate schema coverage and assert input refusals
Remove 30 redundant truthy-JSON schema checks. Validate advertised groups and property parity across every primary command, retain required-field checks, and assert structured malformed-input errors. Exercise JEB positional validation rather than an unknown flag. Validation: 13 public CLI adapter tests, combined checks, and temporary-directory hygiene. Host configuration refusal coverage from main is preserved.
This commit is contained in:
@@ -11,18 +11,6 @@ const serve = async (
|
||||
): Promise<{ readonly stdout: string; readonly exitCode: number }> =>
|
||||
serveCli(argv, jebEnvironment);
|
||||
|
||||
it.each([
|
||||
["inspect-jeb-client"],
|
||||
["open-jeb-project"],
|
||||
["list-jeb-units"],
|
||||
["decompile-jeb-item"],
|
||||
])("%s advertises a schema through the public CLI", async (command) => {
|
||||
const result = await serve([command, "--schema", "--json"]);
|
||||
expect(result.exitCode, command).toBe(0);
|
||||
const schema = JSON.parse(result.stdout) as { args?: unknown };
|
||||
expect(schema).toBeTruthy();
|
||||
});
|
||||
|
||||
it("reports an unreachable engine endpoint with recovery guidance", async () => {
|
||||
const result = await serve(["inspect-jeb-client", "--json"]);
|
||||
expect(result.stdout).toContain("capability_unavailable");
|
||||
@@ -30,13 +18,15 @@ it("reports an unreachable engine endpoint with recovery guidance", async () =>
|
||||
});
|
||||
|
||||
it("validates decompile item input before contacting the engine", async () => {
|
||||
const result = await serve([
|
||||
"decompile-jeb-item",
|
||||
"not-an-address",
|
||||
"--item-kind",
|
||||
"method",
|
||||
"--json",
|
||||
]);
|
||||
expect(result.stdout).toBeTruthy();
|
||||
expect(result.stdout).not.toContain("capability_unavailable");
|
||||
const result = await serve(["decompile-jeb-item", "", "method", "--json"]);
|
||||
expect(result.exitCode).toBe(1);
|
||||
expect(JSON.parse(result.stdout)).toMatchObject({
|
||||
code: "VALIDATION_ERROR",
|
||||
fieldErrors: [
|
||||
{
|
||||
code: "too_small",
|
||||
path: "item-address",
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user