Assert agent event unsubscribe behavior in ws adapter

Co-authored-by: Theo Browne <[email protected]>
This commit is contained in:
Cursor AgentandTheo Browne committed 2026-02-09 23:26:59 +00:00
1 parent 770af97034
commit f3ac685f1c
1 file changed
+27
+27
View File
@@ -414,5 +414,32 @@ describe("wsNativeApi", () => {
unsubscribeOutput();
unsubscribeExit();
socket?.emitMessage(
JSON.stringify({
type: "event",
channel: "agent:output",
payload: {
sessionId: "agent-session-1",
stream: "stdout",
data: "ignored",
},
}),
);
socket?.emitMessage(
JSON.stringify({
type: "event",
channel: "agent:exit",
payload: {
sessionId: "agent-session-1",
code: 1,
signal: null,
},
}),
);
await new Promise((resolve) => {
setTimeout(resolve, 25);
});
expect(outputEvents).toHaveLength(1);
expect(exitEvents).toHaveLength(1);
});
});