()
| 11 | import { http, HttpResponse, passthrough } from "msw"; |
| 12 | |
| 13 | const testService = () => { |
| 14 | const client = testInstance(); |
| 15 | const prefix = `test${Math.random().toString(36).substring(2, 15)}`; |
| 16 | |
| 17 | client.register({ |
| 18 | name: `${prefix}_echo`, |
| 19 | handler: async (input: { text: string }) => { |
| 20 | return { echo: input.text }; |
| 21 | }, |
| 22 | schema: z.object({ |
| 23 | text: z.string(), |
| 24 | }), |
| 25 | }); |
| 26 | |
| 27 | client.register({ |
| 28 | name: `${prefix}_error`, |
| 29 | handler: async (_input) => { |
| 30 | throw new Error("This is an error"); |
| 31 | }, |
| 32 | schema: z.object({ |
| 33 | text: z.string(), |
| 34 | }), |
| 35 | }); |
| 36 | |
| 37 | return { |
| 38 | client, |
| 39 | prefix, |
| 40 | }; |
| 41 | }; |
| 42 | |
| 43 | describe("AgentRPC", () => { |
| 44 | const env = process.env; |
no test coverage detected