test(linux): verify setup through CLI and MCP

This commit is contained in:
morluto
2026-07-13 21:20:51 +00:00
parent 75818d119e
commit 67504d2d51
20 changed files with 632 additions and 123 deletions
+12
View File
@@ -3,6 +3,8 @@ import { z } from "zod";
import type { ToolContract } from "../src/contracts/toolContracts.js";
import { ok } from "../src/domain/result.js";
import { err } from "../src/domain/result.js";
import { HopperProcessError } from "../src/domain/errors.js";
import { toCallToolResult } from "../src/server/toolResult.js";
const contract: ToolContract = {
@@ -21,6 +23,16 @@ const contract: ToolContract = {
};
describe("tool result projection", () => {
it("exposes an actionable adapter code to MCP callers", () => {
const result = toCallToolResult(err(new HopperProcessError(76)), contract);
expect(result.structuredContent).toMatchObject({
error: {
code: "unsupported_demo_dialog",
category: "execution_failure",
},
});
expect(JSON.stringify(result)).not.toContain("expected Hopper");
});
it("classifies output contract failures without naming a provider", () => {
expect(toCallToolResult(ok({ value: 42 }), contract)).toEqual({
content: [