From 071ea13cc48b4da1a2259301eb7be7667598e92d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hartmut=20N=C3=B6renberg?= Date: Wed, 1 Apr 2026 07:45:02 +0200 Subject: [PATCH] test(api): stabilize chargeability stats regression --- packages/api/src/__tests__/resource-router.test.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/api/src/__tests__/resource-router.test.ts b/packages/api/src/__tests__/resource-router.test.ts index 9a82726..59ad664 100644 --- a/packages/api/src/__tests__/resource-router.test.ts +++ b/packages/api/src/__tests__/resource-router.test.ts @@ -443,6 +443,10 @@ describe("resource router", () => { }); it("counts imported TBD draft projects in chargeability stats only when proposed work is enabled", async () => { + vi.useFakeTimers(); + vi.setSystemTime(new Date("2026-03-15T12:00:00.000Z")); + + try { const db = { resource: { findMany: vi.fn().mockResolvedValue([ @@ -494,6 +498,9 @@ describe("resource router", () => { expect(strict[0]?.expectedChargeability).toBeGreaterThan(0); expect(withProposed[0]?.actualChargeability).toBeGreaterThan(strict[0]?.actualChargeability ?? 0); expect(withProposed[0]?.expectedChargeability).toBe(strict[0]?.expectedChargeability); + } finally { + vi.useRealTimers(); + } }); it("excludes regional public holidays from chargeability stats", async () => {