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.
33 lines
967 B
TypeScript
33 lines
967 B
TypeScript
import { expect, it } from "vitest";
|
|
|
|
import { serveCli } from "./cliServeHarness.js";
|
|
|
|
const jebEnvironment = {
|
|
REA_JEB_MCP_URL: "http://127.0.0.1:1/mcp",
|
|
};
|
|
|
|
const serve = async (
|
|
argv: readonly string[],
|
|
): Promise<{ readonly stdout: string; readonly exitCode: number }> =>
|
|
serveCli(argv, jebEnvironment);
|
|
|
|
it("reports an unreachable engine endpoint with recovery guidance", async () => {
|
|
const result = await serve(["inspect-jeb-client", "--json"]);
|
|
expect(result.stdout).toContain("capability_unavailable");
|
|
expect(result.stdout).toContain("REA_JEB_MCP_URL");
|
|
});
|
|
|
|
it("validates decompile item input before contacting the engine", async () => {
|
|
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",
|
|
},
|
|
],
|
|
});
|
|
});
|