From 769b76cd40b1701c7cbbe12f20454caeaa76c685 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Thu, 8 Jan 2026 23:52:07 +0100 Subject: [PATCH] test(provider-activity): restore real timers --- src/infra/provider-activity.test.ts | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/infra/provider-activity.test.ts b/src/infra/provider-activity.test.ts index 5c8e08387..85ae8c6d5 100644 --- a/src/infra/provider-activity.test.ts +++ b/src/infra/provider-activity.test.ts @@ -1,4 +1,4 @@ -import { beforeEach, describe, expect, it, vi } from "vitest"; +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { getProviderActivity, @@ -13,6 +13,10 @@ describe("provider activity", () => { vi.setSystemTime(new Date("2026-01-08T00:00:00Z")); }); + afterEach(() => { + vi.useRealTimers(); + }); + it("records inbound/outbound separately", () => { recordProviderActivity({ provider: "telegram", direction: "inbound" }); vi.advanceTimersByTime(1000); @@ -35,13 +39,17 @@ describe("provider activity", () => { direction: "inbound", at: 2, }); - expect(getProviderActivity({ provider: "whatsapp", accountId: "a" })).toEqual({ - inboundAt: 1, - outboundAt: null, - }); - expect(getProviderActivity({ provider: "whatsapp", accountId: "b" })).toEqual({ - inboundAt: 2, - outboundAt: null, - }); + expect(getProviderActivity({ provider: "whatsapp", accountId: "a" })).toEqual( + { + inboundAt: 1, + outboundAt: null, + }, + ); + expect(getProviderActivity({ provider: "whatsapp", accountId: "b" })).toEqual( + { + inboundAt: 2, + outboundAt: null, + }, + ); }); });