()
| 11 | const jsonrpc = "2.0" as const; |
| 12 | |
| 13 | const makeEngine = (): JRPCEngineV2 => { |
| 14 | return JRPCEngineV2.create<JRPCMiddlewareV2>({ |
| 15 | middleware: [ |
| 16 | ({ request }): Json | undefined => { |
| 17 | if (request.method !== "hello") { |
| 18 | throw new Error("Unknown method"); |
| 19 | } |
| 20 | return isRequest(request) ? ((request.params as Json) ?? null) : undefined; |
| 21 | }, |
| 22 | ], |
| 23 | }); |
| 24 | }; |
| 25 | |
| 26 | describe("JsonRpcServer", () => { |
| 27 | it("can be constructed with an engine", () => { |
no test coverage detected