Cover binary 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 05:58:03 +00:00
1 parent 397edfe088
commit b6b20455e4
1 file changed
+43
+43
View File
@@ -1597,6 +1597,49 @@ async function main() {
});
});
await new Promise((resolve, reject) => {
const timer = setTimeout(
() => reject(new Error("Smoke test failed: binary 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-binary-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: binary websocket app.health response mismatch."));
return;
}
clearTimeout(timer);
ws.removeEventListener("message", onMessage);
resolve();
};
ws.addEventListener("message", onMessage);
const encodedBinaryRequest = new TextEncoder().encode(
JSON.stringify({
type: "request",
id: "smoke-binary-health",
method: "app.health",
}),
);
ws.send(encodedBinaryRequest);
});
const bootstrapResponse = await sendWsRequest(ws, {
id: "smoke-bootstrap",
method: "app.bootstrap",