test(provider-activity): restore real timers
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getProviderActivity,
|
getProviderActivity,
|
||||||
@@ -13,6 +13,10 @@ describe("provider activity", () => {
|
|||||||
vi.setSystemTime(new Date("2026-01-08T00:00:00Z"));
|
vi.setSystemTime(new Date("2026-01-08T00:00:00Z"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
vi.useRealTimers();
|
||||||
|
});
|
||||||
|
|
||||||
it("records inbound/outbound separately", () => {
|
it("records inbound/outbound separately", () => {
|
||||||
recordProviderActivity({ provider: "telegram", direction: "inbound" });
|
recordProviderActivity({ provider: "telegram", direction: "inbound" });
|
||||||
vi.advanceTimersByTime(1000);
|
vi.advanceTimersByTime(1000);
|
||||||
@@ -35,13 +39,17 @@ describe("provider activity", () => {
|
|||||||
direction: "inbound",
|
direction: "inbound",
|
||||||
at: 2,
|
at: 2,
|
||||||
});
|
});
|
||||||
expect(getProviderActivity({ provider: "whatsapp", accountId: "a" })).toEqual({
|
expect(getProviderActivity({ provider: "whatsapp", accountId: "a" })).toEqual(
|
||||||
inboundAt: 1,
|
{
|
||||||
outboundAt: null,
|
inboundAt: 1,
|
||||||
});
|
outboundAt: null,
|
||||||
expect(getProviderActivity({ provider: "whatsapp", accountId: "b" })).toEqual({
|
},
|
||||||
inboundAt: 2,
|
);
|
||||||
outboundAt: null,
|
expect(getProviderActivity({ provider: "whatsapp", accountId: "b" })).toEqual(
|
||||||
});
|
{
|
||||||
|
inboundAt: 2,
|
||||||
|
outboundAt: null,
|
||||||
|
},
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user