From f3a5b96b62364710d478b7318b27e88f04fe26ea Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Wed, 15 Apr 2026 01:01:18 +0100 Subject: [PATCH] test(gateway): harden runtime services delivery recovery assertion --- src/gateway/server-runtime-services.test.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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", () => {