Run an `execute` tool call whose code hits `path`, with MSW returning `body`.
(path: string, body: unknown, init?: ResponseInit)
| 26 | |
| 27 | /** Run an `execute` tool call whose code hits `path`, with MSW returning `body`. */ |
| 28 | async function runExecute(path: string, body: unknown, init?: ResponseInit): Promise<string> { |
| 29 | mockIdentityProbe({ accounts: [{ id: ACCOUNT_ID, name: 'Acc' }] }) |
| 30 | server.use( |
| 31 | http.get(`${API_BASE}${path}`, () => |
| 32 | typeof body === 'string' |
| 33 | ? new HttpResponse(body, init) |
| 34 | : HttpResponse.json(body as object, init) |
| 35 | ) |
| 36 | ) |
| 37 | const result = await callTool(API_TOKEN, 'execute', { |
| 38 | code: `async () => cloudflare.request({ method: "GET", path: "${path}" })` |
| 39 | }) |
| 40 | return toolText(result) |
| 41 | } |
| 42 | |
| 43 | describe('codemode tool titles', () => { |
| 44 | it('exposes a title on the execute tool', async () => { |
no test coverage detected