feat(platform): harden access scoping and delivery baseline

This commit is contained in:
2026-03-30 00:27:31 +02:00
parent 00b936fa1f
commit 819345acfa
109 changed files with 26142 additions and 8081 deletions
@@ -70,6 +70,12 @@ describe("dashboard use-cases", () => {
},
]),
},
vacation: {
count: vi.fn().mockResolvedValue(2),
},
estimate: {
count: vi.fn().mockResolvedValue(5),
},
};
const result = await getDashboardOverview(db as never);
@@ -83,6 +89,8 @@ describe("dashboard use-cases", () => {
{ status: "ACTIVE", count: 1 },
{ status: "DRAFT", count: 1 },
]);
expect(result.approvedVacations).toBe(2);
expect(result.totalEstimates).toBe(5);
expect(result.chapterUtilization).toEqual([
{ chapter: "CGI", resourceCount: 2, avgChargeabilityTarget: 70 },
{ chapter: "Unassigned", resourceCount: 1, avgChargeabilityTarget: 0 },
@@ -134,6 +142,12 @@ describe("dashboard use-cases", () => {
auditLog: {
findMany: vi.fn().mockResolvedValue([]),
},
vacation: {
count: vi.fn().mockResolvedValue(0),
},
estimate: {
count: vi.fn().mockResolvedValue(0),
},
};
const result = await getDashboardOverview(db as never);
@@ -242,12 +256,20 @@ describe("dashboard use-cases", () => {
auditLog: {
findMany: vi.fn().mockResolvedValue([]),
},
vacation: {
count: vi.fn().mockResolvedValue(1),
},
estimate: {
count: vi.fn().mockResolvedValue(2),
},
};
const result = await getDashboardOverview(db as never);
expect(result.totalAllocations).toBe(3);
expect(result.activeAllocations).toBe(2);
expect(result.approvedVacations).toBe(1);
expect(result.totalEstimates).toBe(2);
expect(result.budgetSummary).toEqual({
totalBudgetCents: 100_000,
totalCostCents: 4_000,
@@ -954,6 +976,12 @@ describe("dashboard use-cases", () => {
auditLog: {
findMany: vi.fn().mockResolvedValue([]),
},
vacation: {
count: vi.fn().mockResolvedValue(1),
},
estimate: {
count: vi.fn().mockResolvedValue(4),
},
};
const result = await getDashboardOverview(db as never);
@@ -963,6 +991,8 @@ describe("dashboard use-cases", () => {
totalCostCents: 1_000,
avgUtilizationPercent: 10,
});
expect(result.approvedVacations).toBe(1);
expect(result.totalEstimates).toBe(4);
});
it("excludes regional public holidays from project health budget usage", async () => {