chore(repo): initialize planarchy workspace

This commit is contained in:
2026-03-14 14:31:09 +01:00
commit dd55d0e78b
769 changed files with 166461 additions and 0 deletions
@@ -0,0 +1,80 @@
import { AllocationStatus } from "@planarchy/shared";
import { describe, expect, it } from "vitest";
import { buildTimelineShiftPlan } from "../router/timeline-shift-planning.js";
describe("buildTimelineShiftPlan", () => {
it("builds validation assignments from explicit assignments", () => {
const result = buildTimelineShiftPlan({
demandRequirements: [
{
id: "demand_1",
projectId: "project_1",
startDate: new Date("2026-03-16"),
endDate: new Date("2026-03-20"),
hoursPerDay: 8,
percentage: 100,
role: "FX",
roleId: "role_fx",
headcount: 2,
status: AllocationStatus.PROPOSED,
metadata: {},
createdAt: new Date("2026-03-13"),
updatedAt: new Date("2026-03-13"),
},
],
assignments: [
{
id: "assignment_1",
resourceId: "resource_1",
projectId: "project_1",
startDate: new Date("2026-03-16"),
endDate: new Date("2026-03-20"),
hoursPerDay: 6,
percentage: 75,
role: "Comp",
roleId: "role_comp",
dailyCostCents: 30000,
status: AllocationStatus.ACTIVE,
metadata: { includeSaturday: true },
createdAt: new Date("2026-03-13"),
updatedAt: new Date("2026-03-13"),
resource: {
id: "resource_1",
displayName: "Alice",
eid: "E-001",
lcrCents: 5000,
availability: { monday: 8 },
},
},
],
allAssignmentWindows: [
{
id: "assignment_1",
resourceId: "resource_1",
projectId: "project_1",
startDate: new Date("2026-03-16"),
endDate: new Date("2026-03-20"),
hoursPerDay: 6,
status: AllocationStatus.ACTIVE,
},
],
});
expect(result.validationAllocations).toHaveLength(1);
expect(result.validationAllocations.map((entry) => entry.sourceAllocationId)).toEqual([
"assignment_1",
]);
expect(result.validationAllocations[0]?.includeSaturday).toBe(true);
expect(result.validationAllocations[0]?.allAllocationsForResource).toEqual([
{
id: "assignment_1",
resourceId: "resource_1",
projectId: "project_1",
startDate: new Date("2026-03-16"),
endDate: new Date("2026-03-20"),
hoursPerDay: 6,
status: AllocationStatus.ACTIVE,
},
]);
});
});