diff --git a/src/gateway/server-runtime-services.test.ts b/src/gateway/server-runtime-services.test.ts index 6c61fc2c83b..729ca45caaf 100644 --- a/src/gateway/server-runtime-services.test.ts +++ b/src/gateway/server-runtime-services.test.ts @@ -40,6 +40,7 @@ const { activateGatewayScheduledServices, startGatewayRuntimeServices } = describe("server-runtime-services", () => { beforeEach(() => { + vi.useRealTimers(); hoisted.heartbeatRunner.stop.mockClear(); hoisted.heartbeatRunner.updateConfig.mockClear(); hoisted.startHeartbeatRunner.mockClear(); @@ -84,14 +85,13 @@ describe("server-runtime-services", () => { expect(hoisted.startHeartbeatRunner).toHaveBeenCalledTimes(1); expect(cron.start).toHaveBeenCalledTimes(1); expect(services.heartbeatRunner).toBe(hoisted.heartbeatRunner); - await vi.waitFor(() => { - expect(hoisted.recoverPendingDeliveries).toHaveBeenCalledWith( - expect.objectContaining({ - deliver: hoisted.deliverOutboundPayloads, - cfg: {}, - }), - ); - }); + await vi.dynamicImportSettled(); + expect(hoisted.recoverPendingDeliveries).toHaveBeenCalledWith( + expect.objectContaining({ + deliver: hoisted.deliverOutboundPayloads, + cfg: {}, + }), + ); }); it("keeps scheduled services disabled for minimal test gateways", () => {