Files
CapaKraken/packages/application/src/__tests__/count-planning-entries.test.ts
T
Hartmut cd78f72f33 chore: full technical rename planarchy → capakraken
Complete rename of all technical identifiers across the codebase:

Package names (11 packages):
- @planarchy/* → @capakraken/* in all package.json, tsconfig, imports

Import statements: 277 files, 548 occurrences replaced

Database & Docker:
- PostgreSQL user/db: planarchy → capakraken
- Docker volumes: planarchy_pgdata → capakraken_pgdata
- Connection strings updated in docker-compose, .env, CI

CI/CD:
- GitHub Actions workflow: all filter commands updated
- Test database credentials updated

Infrastructure:
- Redis channel: planarchy:sse → capakraken:sse
- Logger service name: planarchy-api → capakraken-api
- Anonymization seed updated
- Start/stop/restart scripts updated

Test data:
- Seed emails: @planarchy.dev → @capakraken.dev
- E2E test credentials: all 11 spec files updated
- Email defaults: @planarchy.app → @capakraken.app
- localStorage keys: planarchy_* → capakraken_*

Documentation: 30+ .md files updated

Verification:
- pnpm install: workspace resolution works
- TypeScript: only pre-existing TS2589 (no new errors)
- Engine: 310/310 tests pass
- Staffing: 37/37 tests pass

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-03-27 13:18:09 +01:00

59 lines
1.9 KiB
TypeScript

import { AllocationStatus } from "@capakraken/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);
});
});