diff --git a/src/gateway/server.chat.gateway-server-chat.test.ts b/src/gateway/server.chat.gateway-server-chat.test.ts index 0afbe341934..aab3d3cf7d7 100644 --- a/src/gateway/server.chat.gateway-server-chat.test.ts +++ b/src/gateway/server.chat.gateway-server-chat.test.ts @@ -488,15 +488,16 @@ describe("gateway server chat", () => { }, }); - const agentBlockedRes = await rpcReq(ws, "agent", { + vi.mocked(agentCommand).mockClear(); + const agentAllowedRes = await rpcReq(ws, "agent", { sessionKey: "cron:job-1", message: "hi", idempotencyKey: "idem-2", }); - expect(agentBlockedRes.ok).toBe(false); - expect((agentBlockedRes.error as { message?: string } | undefined)?.message ?? "").toMatch( - /send blocked/i, - ); + expect(agentAllowedRes.ok).toBe(true); + expect(agentAllowedRes.payload?.status).toBe("accepted"); + expect(agentAllowedRes.payload?.runId).toBe("idem-2"); + await vi.waitFor(() => expect(agentCommand).toHaveBeenCalled()); testState.sessionStorePath = undefined; testState.sessionConfig = undefined;