test(api): stabilize chargeability stats regression

This commit is contained in:
2026-04-01 07:45:02 +02:00
parent 8c5be51251
commit 071ea13cc4
@@ -443,6 +443,10 @@ describe("resource router", () => {
}); });
it("counts imported TBD draft projects in chargeability stats only when proposed work is enabled", async () => { 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 = { const db = {
resource: { resource: {
findMany: vi.fn().mockResolvedValue([ findMany: vi.fn().mockResolvedValue([
@@ -494,6 +498,9 @@ describe("resource router", () => {
expect(strict[0]?.expectedChargeability).toBeGreaterThan(0); expect(strict[0]?.expectedChargeability).toBeGreaterThan(0);
expect(withProposed[0]?.actualChargeability).toBeGreaterThan(strict[0]?.actualChargeability ?? 0); expect(withProposed[0]?.actualChargeability).toBeGreaterThan(strict[0]?.actualChargeability ?? 0);
expect(withProposed[0]?.expectedChargeability).toBe(strict[0]?.expectedChargeability); expect(withProposed[0]?.expectedChargeability).toBe(strict[0]?.expectedChargeability);
} finally {
vi.useRealTimers();
}
}); });
it("excludes regional public holidays from chargeability stats", async () => { it("excludes regional public holidays from chargeability stats", async () => {