Cover renderer handling of overlong websocket error responses

Co-authored-by: Theo Browne <[email protected]>
This commit is contained in:
Cursor AgentandTheo Browne committed 2026-02-10 13:19:54 +00:00
1 parent a59108c31f
commit c6d7efc213
1 file changed
+17 -1
+17 -1
View File
@@ -1,5 +1,10 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import { WS_CLOSE_CODES, WS_CLOSE_REASONS, WS_REQUEST_ID_MAX_CHARS } from "@acme/contracts";
import {
WS_CLOSE_CODES,
WS_CLOSE_REASONS,
WS_ERROR_MESSAGE_MAX_CHARS,
WS_REQUEST_ID_MAX_CHARS,
} from "@acme/contracts";
type Listener = (event: unknown) => void;
@@ -3154,6 +3159,17 @@ describe("wsNativeApi", () => {
unexpected: true,
}),
);
socket?.emitMessage(
JSON.stringify({
type: "response",
id: requestEnvelope.id,
ok: false,
error: {
code: "request_failed",
message: "m".repeat(WS_ERROR_MESSAGE_MAX_CHARS + 1),
},
}),
);
socket?.emitMessage(
JSON.stringify({
type: "response",