chore(repo): initialize planarchy workspace
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
import { AllocationStatus } from "@planarchy/shared";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { countPlanningEntries } from "../index.js";
|
||||
|
||||
describe("countPlanningEntries", () => {
|
||||
it("counts demand and assignment planning entries", async () => {
|
||||
const result = await countPlanningEntries(
|
||||
{
|
||||
demandRequirement: {
|
||||
findMany: vi.fn().mockResolvedValue([
|
||||
{
|
||||
id: "demand_1",
|
||||
projectId: "project_1",
|
||||
startDate: new Date("2026-03-17"),
|
||||
endDate: new Date("2026-03-18"),
|
||||
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"),
|
||||
},
|
||||
]),
|
||||
},
|
||||
assignment: {
|
||||
findMany: vi.fn().mockResolvedValue([
|
||||
{
|
||||
id: "assignment_1",
|
||||
demandRequirementId: null,
|
||||
resourceId: "resource_1",
|
||||
projectId: "project_1",
|
||||
startDate: new Date("2026-03-17"),
|
||||
endDate: new Date("2026-03-18"),
|
||||
hoursPerDay: 8,
|
||||
percentage: 100,
|
||||
role: "Lead",
|
||||
roleId: "role_lead",
|
||||
dailyCostCents: 32000,
|
||||
status: AllocationStatus.ACTIVE,
|
||||
metadata: {},
|
||||
createdAt: new Date("2026-03-13"),
|
||||
updatedAt: new Date("2026-03-13"),
|
||||
},
|
||||
]),
|
||||
},
|
||||
} as never,
|
||||
{ projectIds: ["project_1"] },
|
||||
);
|
||||
|
||||
expect(result.totalCount).toBe(2);
|
||||
expect(result.countsByProjectId.get("project_1")).toBe(2);
|
||||
expect(result.countsByRoleId.get("role_fx")).toBe(1);
|
||||
expect(result.countsByRoleId.get("role_lead")).toBe(1);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user