mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-07 06:16:06 -10:00
test(runner): type MCP scope response assertions
Co-Authored-By: Paperclip <[email protected]>
This commit is contained in:
1 parent
84555b0554
commit
ffccebca19
2 files changed
+6
-4
No files matched your search
@@ -407,12 +407,13 @@ it("returns missing-field guidance before dispatch and accepts an explicit retry
|
||||
} }], handler });
|
||||
bridges.push(bridge);
|
||||
const request = { id: "scope-retry", method: "tools/call", params: { name: "read_task_document", arguments: { key: "sentry-case" } } };
|
||||
const rejected = await (await rpc(bridge, request)).json();
|
||||
type ScopeResponse = { result: { isError?: boolean; content: Array<{ text: string }> } };
|
||||
const rejected = await (await rpc(bridge, request)).json() as ScopeResponse;
|
||||
expect(rejected).toMatchObject({ result: { isError: true } });
|
||||
expect(handler).not.toHaveBeenCalled();
|
||||
expect(rejected.result.content[0].text).toContain(guidance);
|
||||
const taskId = "00000000-0000-4000-8000-000000000005";
|
||||
const accepted = await (await rpc(bridge, { ...request, params: { ...request.params, arguments: { key: "sentry-case", taskId } } })).json();
|
||||
const accepted = await (await rpc(bridge, { ...request, params: { ...request.params, arguments: { key: "sentry-case", taskId } } })).json() as ScopeResponse;
|
||||
expect(accepted.result.isError).not.toBe(true);
|
||||
expect(handler).toHaveBeenCalledExactlyOnceWith(expect.objectContaining({ arguments: { key: "sentry-case", taskId } }));
|
||||
});
|
||||
@@ -658,12 +658,13 @@ it("returns missing-field guidance before dispatch and accepts an explicit retry
|
||||
} }], handler });
|
||||
bridges.push(bridge);
|
||||
const request = { id: "scope-retry", method: "tools/call", params: { name: "read_task_document", arguments: { key: "sentry-case" } } };
|
||||
const rejected = await (await rpc(bridge, request)).json();
|
||||
type ScopeResponse = { result: { isError?: boolean; content: Array<{ text: string }> } };
|
||||
const rejected = await (await rpc(bridge, request)).json() as ScopeResponse;
|
||||
expect(rejected).toMatchObject({ result: { isError: true } });
|
||||
expect(handler).not.toHaveBeenCalled();
|
||||
expect(rejected.result.content[0].text).toContain(guidance);
|
||||
const taskId = "00000000-0000-4000-8000-000000000005";
|
||||
const accepted = await (await rpc(bridge, { ...request, params: { ...request.params, arguments: { key: "sentry-case", taskId } } })).json();
|
||||
const accepted = await (await rpc(bridge, { ...request, params: { ...request.params, arguments: { key: "sentry-case", taskId } } })).json() as ScopeResponse;
|
||||
expect(accepted.result.isError).not.toBe(true);
|
||||
expect(handler).toHaveBeenCalledExactlyOnceWith(expect.objectContaining({ arguments: { key: "sentry-case", taskId } }));
|
||||
});
|
||||
Reference in new issue
Block a user