diff --git a/src/gateway/server.hooks.test.ts b/src/gateway/server.hooks.test.ts index 5f161cc598c..9672922a92b 100644 --- a/src/gateway/server.hooks.test.ts +++ b/src/gateway/server.hooks.test.ts @@ -260,7 +260,9 @@ describe("gateway server hooks", () => { messages: [{ id: "msg-1", from: "Ada", subject: "Hello", snippet: "Hi", body: "Body" }], }); expect(response.status).toBe(200); - await waitForSystemEvent(); + await expect + .poll(() => cronIsolatedRun.mock.calls.length, { timeout: 2_000, interval: 10 }) + .toBe(1); const call = (cronIsolatedRun.mock.calls[0] as unknown[] | undefined)?.[0] as { sessionKey?: string;