Files
Nexus/packages/application/src/__tests__/count-estimate-handoff-planning-entries.test.ts
T
Hartmut b41c1d2501
CI / Architecture Guardrails (push) Successful in 2m38s
CI / Assistant Split Regression (push) Successful in 3m33s
CI / Typecheck (push) Successful in 3m51s
CI / Lint (push) Successful in 5m2s
CI / E2E Tests (push) Has been cancelled
CI / Fresh-Linux Docker Deploy (push) Has been cancelled
CI / Release Images (push) Has been cancelled
CI / Build (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
rename(phase 1): CapaKraken → Nexus across code, UI, docs, CI (#61)
rename(phase 1): CapaKraken → Nexus across code, UI, docs, CI (#61)

Co-authored-by: Hartmut Nörenberg <hn@hartmut-noerenberg.com>
Co-committed-by: Hartmut Nörenberg <hn@hartmut-noerenberg.com>
2026-05-21 16:28:40 +02:00

73 lines
2.6 KiB
TypeScript

import { AllocationStatus } from "@nexus/shared";
import { describe, expect, it, vi } from "vitest";
import { countEstimateHandoffPlanningEntries } from "../index.js";
describe("countEstimateHandoffPlanningEntries", () => {
it("counts demand and assignment handoff entries", async () => {
const result = await countEstimateHandoffPlanningEntries(
{
demandRequirement: {
findMany: vi.fn().mockResolvedValue([
{
id: "demand_handoff",
projectId: "project_1",
startDate: new Date("2026-03-17"),
endDate: new Date("2026-03-18"),
hoursPerDay: 8,
percentage: 100,
role: "Comp",
roleId: "role_comp",
headcount: 1,
status: AllocationStatus.PROPOSED,
metadata: { estimateHandoff: { estimateVersionId: "ver_1" } },
createdAt: new Date("2026-03-13"),
updatedAt: new Date("2026-03-13"),
},
]),
},
assignment: {
findMany: vi.fn().mockResolvedValue([
{
id: "assignment_handoff",
demandRequirementId: "demand_handoff",
resourceId: "resource_1",
projectId: "project_1",
startDate: new Date("2026-03-17"),
endDate: new Date("2026-03-18"),
hoursPerDay: 8,
percentage: 100,
role: "Comp",
roleId: "role_comp",
dailyCostCents: 32000,
status: AllocationStatus.PROPOSED,
metadata: { estimateHandoff: { estimateVersionId: "ver_1" } },
createdAt: new Date("2026-03-13"),
updatedAt: new Date("2026-03-13"),
},
{
id: "assignment_explicit_only",
demandRequirementId: null,
resourceId: "resource_2",
projectId: "project_1",
startDate: new Date("2026-03-19"),
endDate: new Date("2026-03-20"),
hoursPerDay: 4,
percentage: 50,
role: "Lead",
roleId: "role_lead",
dailyCostCents: 20000,
status: AllocationStatus.PROPOSED,
metadata: { estimateHandoff: { estimateVersionId: "ver_1" } },
createdAt: new Date("2026-03-13"),
updatedAt: new Date("2026-03-13"),
},
]),
},
} as never,
{ projectId: "project_1", estimateVersionId: "ver_1" },
);
expect(result).toBe(3);
});
});