test(gateway): wait for deferred agent session event

This commit is contained in:
Peter Steinberger
2026-04-29 10:45:09 +01:00
parent 1c17fd5edf
commit 146c0a7e1d

View File

@@ -98,14 +98,16 @@ describe("agent handler session create events", () => {
undefined,
{ runId: "idem-agent-create-event" },
);
expect(broadcastToConnIds).toHaveBeenCalledWith(
"sessions.changed",
expect.objectContaining({
sessionKey: "agent:main:subagent:create-test",
reason: "create",
}),
new Set(["conn-1"]),
{ dropIfSlow: true },
await vi.waitFor(() =>
expect(broadcastToConnIds).toHaveBeenCalledWith(
"sessions.changed",
expect.objectContaining({
sessionKey: "agent:main:subagent:create-test",
reason: "create",
}),
new Set(["conn-1"]),
{ dropIfSlow: true },
),
);
});
});