diff --git a/apps/t3/src/runtimeApiServer.test.ts b/apps/t3/src/runtimeApiServer.test.ts index 0466820fc3..a40059b975 100644 --- a/apps/t3/src/runtimeApiServer.test.ts +++ b/apps/t3/src/runtimeApiServer.test.ts @@ -564,6 +564,35 @@ describe("runtimeApiServer", () => { client.socket.close(); }); + it("returns structured errors for invalid shell.openInEditor 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, + "shell-invalid-1", + "shell.openInEditor", + { + cwd: "/workspace", + editor: "unknown-editor", + }, + ); + expect(response.ok).toBe(false); + if (response.ok) { + throw new Error("Expected invalid shell 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,