test(gateway): harden runtime services delivery recovery assertion

This commit is contained in:
Vincent Koc
2026-04-15 01:01:18 +01:00
parent 9577d6609b
commit f3a5b96b62

View File

@@ -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", () => {