Cover buffer websocket request payloads in smoke test

Co-authored-by: Theo Browne <[email protected]>
This commit is contained in:
Cursor AgentandTheo Browne committed 2026-02-10 06:18:17 +00:00
1 parent c30a9e3152
commit 30cfb90254
1 file changed
+43
+43
View File
@@ -1756,6 +1756,49 @@ async function main() {
ws.send(encodedArrayBufferRequest.buffer);
});
await new Promise((resolve, reject) => {
const timer = setTimeout(
() => reject(new Error("Smoke test failed: buffer websocket app.health request timed out.")),
20_000,
);
const onMessage = (event) => {
let message;
try {
message = JSON.parse(String(event.data));
} catch {
return;
}
if (message.type !== "response" || message.id !== "smoke-buffer-health") {
return;
}
if (
message.ok !== true ||
message.result?.status !== "ok" ||
message.result?.launchCwd !== appRoot
) {
clearTimeout(timer);
ws.removeEventListener("message", onMessage);
reject(new Error("Smoke test failed: buffer websocket app.health response mismatch."));
return;
}
clearTimeout(timer);
ws.removeEventListener("message", onMessage);
resolve();
};
ws.addEventListener("message", onMessage);
const encodedBufferRequest = Buffer.from(
JSON.stringify({
type: "request",
id: "smoke-buffer-health",
method: "app.health",
}),
);
ws.send(encodedBufferRequest);
});
ws.send("not-json");
ws.send(JSON.stringify({ foo: "bar" }));
const postMalformedHealthResponse = await sendWsRequest(ws, {