diff --git a/apps/t3/src/runtimeApiServer.test.ts b/apps/t3/src/runtimeApiServer.test.ts index 9e3e4ed292..df79fac6da 100644 --- a/apps/t3/src/runtimeApiServer.test.ts +++ b/apps/t3/src/runtimeApiServer.test.ts @@ -621,6 +621,32 @@ describe("runtimeApiServer", () => { client.socket.close(); }); + it("returns structured errors for invalid todos.toggle payloads", async () => { + const server = await startRuntimeApiServer({ + port: 0, + launchCwd: process.cwd(), + }); + servers.push(server); + + const client = await connectClient(server.wsUrl); + await client.nextMessage(); + + const response = await sendRequest( + client.socket, + client.nextMessage, + "todo-invalid-1", + "todos.toggle", + "", + ); + expect(response.ok).toBe(false); + if (response.ok) { + throw new Error("Expected invalid todo id payload to fail."); + } + expect(response.error?.code).toBe("request_failed"); + + client.socket.close(); + }); + it("reports runtime health metadata", async () => { const server = await startRuntimeApiServer({ port: 0,