diff --git a/test/extract-mcp-json.test.ts b/test/extract-mcp-json.test.ts new file mode 100644 index 00000000000..d0aca7df2fc --- /dev/null +++ b/test/extract-mcp-json.test.ts @@ -0,0 +1,15 @@ +import { extractMcpJson } from "../app/mcp/utils"; + +describe("extractMcpJson", () => { + test("extracts the client id and parsed mcp payload", () => { + const content = '```json:mcp:client-1\n{"tool":"x"}\n```'; + expect(extractMcpJson(content)).toEqual({ + clientId: "client-1", + mcp: { tool: "x" }, + }); + }); + + test("returns null when there is no mcp block", () => { + expect(extractMcpJson("no mcp here")).toBeNull(); + }); +});