feat(planning): ship holiday-aware planning and assistant upgrades
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
getDashboardBudgetForecast,
|
||||
getDashboardChargeabilityOverview,
|
||||
getDashboardDemand,
|
||||
getDashboardOverview,
|
||||
getDashboardPeakTimes,
|
||||
getDashboardProjectHealth,
|
||||
getDashboardTopValueResources,
|
||||
} from "../index.js";
|
||||
|
||||
@@ -285,8 +287,28 @@ describe("dashboard use-cases", () => {
|
||||
},
|
||||
resource: {
|
||||
findMany: vi.fn().mockResolvedValue([
|
||||
{ availability: { monday: 8, tuesday: 8, wednesday: 8, thursday: 8, friday: 8 } },
|
||||
{ availability: { monday: 6, tuesday: 6, wednesday: 6, thursday: 6, friday: 6 } },
|
||||
{
|
||||
id: "res_1",
|
||||
displayName: "Alice",
|
||||
chapter: "CGI",
|
||||
availability: { monday: 8, tuesday: 8, wednesday: 8, thursday: 8, friday: 8 },
|
||||
countryId: "country_de",
|
||||
federalState: null,
|
||||
metroCityId: "city_1",
|
||||
country: { code: "DE" },
|
||||
metroCity: { name: "Munich" },
|
||||
},
|
||||
{
|
||||
id: "res_2",
|
||||
displayName: "Bob",
|
||||
chapter: "Lighting",
|
||||
availability: { monday: 6, tuesday: 6, wednesday: 6, thursday: 6, friday: 6 },
|
||||
countryId: "country_de",
|
||||
federalState: null,
|
||||
metroCityId: "city_2",
|
||||
country: { code: "DE" },
|
||||
metroCity: { name: "Hamburg" },
|
||||
},
|
||||
]),
|
||||
},
|
||||
};
|
||||
@@ -299,15 +321,113 @@ describe("dashboard use-cases", () => {
|
||||
});
|
||||
|
||||
expect(result).toEqual([
|
||||
{
|
||||
expect.objectContaining({
|
||||
period: "2026-03",
|
||||
groups: [
|
||||
{ name: "ALPHA", hours: 8 },
|
||||
{ name: "ALPHA", hours: 4 },
|
||||
{ name: "BRAVO", hours: 3 },
|
||||
],
|
||||
totalHours: 11,
|
||||
capacityHours: 308,
|
||||
totalHours: 7,
|
||||
capacityHours: 28,
|
||||
derivation: expect.objectContaining({
|
||||
bookedHours: 7,
|
||||
capacityHours: 28,
|
||||
remainingCapacityHours: 21,
|
||||
overbookedHours: 0,
|
||||
utilizationPct: 25,
|
||||
groupCount: 2,
|
||||
resourceCount: 2,
|
||||
}),
|
||||
}),
|
||||
]);
|
||||
});
|
||||
|
||||
it("provides department capacity and utilization details for chapter grouping", async () => {
|
||||
const db = {
|
||||
assignment: {
|
||||
findMany: vi.fn().mockResolvedValue([
|
||||
{
|
||||
id: "assign_1",
|
||||
projectId: "proj_1",
|
||||
resourceId: "res_1",
|
||||
status: "ACTIVE",
|
||||
startDate: new Date("2026-03-02T00:00:00.000Z"),
|
||||
endDate: new Date("2026-03-02T00:00:00.000Z"),
|
||||
hoursPerDay: 8,
|
||||
dailyCostCents: 0,
|
||||
project: { id: "proj_1", name: "Alpha", shortCode: "ALPHA", status: "ACTIVE", orderType: "FIXED" },
|
||||
resource: { id: "res_1", displayName: "Alice", chapter: "CGI" },
|
||||
},
|
||||
]),
|
||||
},
|
||||
resource: {
|
||||
findMany: vi.fn().mockResolvedValue([
|
||||
{
|
||||
id: "res_1",
|
||||
displayName: "Alice",
|
||||
chapter: "CGI",
|
||||
availability: { monday: 8, tuesday: 8, wednesday: 8, thursday: 8, friday: 8 },
|
||||
countryId: "country_de",
|
||||
federalState: null,
|
||||
metroCityId: "city_1",
|
||||
country: { code: "DE" },
|
||||
metroCity: { name: "Munich" },
|
||||
},
|
||||
{
|
||||
id: "res_2",
|
||||
displayName: "Bob",
|
||||
chapter: "Lighting",
|
||||
availability: { monday: 4, tuesday: 4, wednesday: 4, thursday: 4, friday: 4 },
|
||||
countryId: "country_de",
|
||||
federalState: null,
|
||||
metroCityId: "city_2",
|
||||
country: { code: "DE" },
|
||||
metroCity: { name: "Hamburg" },
|
||||
},
|
||||
]),
|
||||
},
|
||||
};
|
||||
|
||||
const result = await getDashboardPeakTimes(db as never, {
|
||||
startDate: new Date("2026-03-02T00:00:00.000Z"),
|
||||
endDate: new Date("2026-03-02T00:00:00.000Z"),
|
||||
granularity: "month",
|
||||
groupBy: "chapter",
|
||||
});
|
||||
|
||||
expect(result).toEqual([
|
||||
expect.objectContaining({
|
||||
period: "2026-03",
|
||||
groups: [
|
||||
expect.objectContaining({
|
||||
name: "CGI",
|
||||
hours: 8,
|
||||
capacityHours: 8,
|
||||
remainingHours: 0,
|
||||
overbookedHours: 0,
|
||||
utilizationPct: 100,
|
||||
}),
|
||||
expect.objectContaining({
|
||||
name: "Lighting",
|
||||
hours: 0,
|
||||
capacityHours: 4,
|
||||
remainingHours: 4,
|
||||
overbookedHours: 0,
|
||||
utilizationPct: 0,
|
||||
}),
|
||||
],
|
||||
totalHours: 8,
|
||||
capacityHours: 12,
|
||||
derivation: expect.objectContaining({
|
||||
bookedHours: 8,
|
||||
capacityHours: 12,
|
||||
remainingCapacityHours: 4,
|
||||
overbookedHours: 0,
|
||||
utilizationPct: 67,
|
||||
groupCount: 2,
|
||||
resourceCount: 2,
|
||||
}),
|
||||
}),
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -513,6 +633,396 @@ describe("dashboard use-cases", () => {
|
||||
expect(withProposed.top[0]?.expectedChargeability).toBe(5);
|
||||
});
|
||||
|
||||
it("excludes regional public holidays from dashboard chargeability availability and bookings", async () => {
|
||||
const db = {
|
||||
assignment: {
|
||||
findMany: vi.fn().mockResolvedValue([
|
||||
{
|
||||
id: "assign_holiday",
|
||||
projectId: "proj_1",
|
||||
resourceId: "res_by",
|
||||
status: "CONFIRMED",
|
||||
startDate: new Date("2026-01-06T00:00:00.000Z"),
|
||||
endDate: new Date("2026-01-06T00:00:00.000Z"),
|
||||
hoursPerDay: 8,
|
||||
dailyCostCents: 0,
|
||||
project: {
|
||||
id: "proj_1",
|
||||
name: "Alpha",
|
||||
shortCode: "ALPHA",
|
||||
status: "ACTIVE",
|
||||
orderType: "CLIENT",
|
||||
dynamicFields: null,
|
||||
},
|
||||
resource: {
|
||||
id: "res_by",
|
||||
displayName: "Bruce",
|
||||
chapter: "CGI",
|
||||
},
|
||||
},
|
||||
]),
|
||||
},
|
||||
resource: {
|
||||
findMany: vi.fn().mockResolvedValue([
|
||||
{
|
||||
id: "res_by",
|
||||
eid: "bruce.banner",
|
||||
displayName: "Bruce",
|
||||
chapter: "CGI",
|
||||
countryId: "country_de",
|
||||
federalState: "BY",
|
||||
metroCityId: "city_augsburg",
|
||||
departed: false,
|
||||
chargeabilityTarget: 80,
|
||||
country: {
|
||||
id: "country_de",
|
||||
code: "DE",
|
||||
},
|
||||
metroCity: {
|
||||
id: "city_augsburg",
|
||||
name: "Augsburg",
|
||||
},
|
||||
availability: { monday: 8, tuesday: 8, wednesday: 8, thursday: 8, friday: 8 },
|
||||
},
|
||||
]),
|
||||
},
|
||||
};
|
||||
|
||||
const result = await getDashboardChargeabilityOverview(db as never, {
|
||||
now: new Date("2026-01-15T00:00:00.000Z"),
|
||||
topN: 10,
|
||||
watchlistThreshold: 15,
|
||||
});
|
||||
|
||||
expect(result.top[0]?.actualChargeability).toBe(0);
|
||||
expect(result.top[0]?.expectedChargeability).toBe(0);
|
||||
expect(result.top[0]).toEqual(
|
||||
expect.objectContaining({
|
||||
countryCode: "DE",
|
||||
federalState: "BY",
|
||||
metroCityName: "Augsburg",
|
||||
derivation: expect.objectContaining({
|
||||
weeklyAvailabilityHours: 40,
|
||||
baseAvailableHours: 184,
|
||||
effectiveAvailableHours: 168,
|
||||
publicHolidayCount: 2,
|
||||
publicHolidayWorkdayCount: 2,
|
||||
publicHolidayHoursDeduction: 16,
|
||||
absenceHoursDeduction: 0,
|
||||
actualBookedHours: 0,
|
||||
expectedBookedHours: 0,
|
||||
targetBookedHours: 134.4,
|
||||
unassignedHours: 168,
|
||||
}),
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("uses holiday-aware capacity in peak times for regional calendars", async () => {
|
||||
const db = {
|
||||
assignment: {
|
||||
findMany: vi.fn().mockResolvedValue([
|
||||
{
|
||||
id: "assign_1",
|
||||
projectId: "proj_1",
|
||||
resourceId: "res_by",
|
||||
status: "CONFIRMED",
|
||||
startDate: new Date("2026-01-05T00:00:00.000Z"),
|
||||
endDate: new Date("2026-01-06T00:00:00.000Z"),
|
||||
hoursPerDay: 8,
|
||||
dailyCostCents: 0,
|
||||
project: { id: "proj_1", name: "Alpha", shortCode: "ALPHA", status: "ACTIVE", orderType: "FIXED" },
|
||||
resource: { id: "res_by", displayName: "Bruce", chapter: "CGI" },
|
||||
},
|
||||
]),
|
||||
},
|
||||
resource: {
|
||||
findMany: vi.fn().mockResolvedValue([
|
||||
{
|
||||
id: "res_by",
|
||||
displayName: "Bruce",
|
||||
chapter: "CGI",
|
||||
availability: { monday: 8, tuesday: 8, wednesday: 8, thursday: 8, friday: 8 },
|
||||
countryId: "country_de",
|
||||
federalState: "BY",
|
||||
metroCityId: "city_munich",
|
||||
country: { code: "DE" },
|
||||
metroCity: { name: "Munich" },
|
||||
},
|
||||
]),
|
||||
},
|
||||
};
|
||||
|
||||
const result = await getDashboardPeakTimes(db as never, {
|
||||
startDate: new Date("2026-01-05T00:00:00.000Z"),
|
||||
endDate: new Date("2026-01-06T00:00:00.000Z"),
|
||||
granularity: "month",
|
||||
groupBy: "project",
|
||||
});
|
||||
|
||||
expect(result).toEqual([
|
||||
expect.objectContaining({
|
||||
period: "2026-01",
|
||||
groups: [{ name: "ALPHA", hours: 8 }],
|
||||
totalHours: 8,
|
||||
capacityHours: 8,
|
||||
derivation: expect.objectContaining({
|
||||
bookedHours: 8,
|
||||
capacityHours: 8,
|
||||
remainingCapacityHours: 0,
|
||||
overbookedHours: 0,
|
||||
utilizationPct: 100,
|
||||
groupCount: 1,
|
||||
resourceCount: 1,
|
||||
}),
|
||||
}),
|
||||
]);
|
||||
});
|
||||
|
||||
it("does not burn budget on regional public holidays", async () => {
|
||||
const db = {
|
||||
project: {
|
||||
findMany: vi.fn().mockResolvedValue([
|
||||
{
|
||||
id: "proj_1",
|
||||
name: "Alpha",
|
||||
shortCode: "ALPHA",
|
||||
budgetCents: 10_000,
|
||||
startDate: new Date("2026-01-01T00:00:00.000Z"),
|
||||
endDate: new Date("2026-12-31T00:00:00.000Z"),
|
||||
clientId: null,
|
||||
client: null,
|
||||
},
|
||||
]),
|
||||
},
|
||||
assignment: {
|
||||
findMany: vi.fn().mockResolvedValue([
|
||||
{
|
||||
projectId: "proj_1",
|
||||
startDate: new Date("2026-01-05T00:00:00.000Z"),
|
||||
endDate: new Date("2026-01-06T00:00:00.000Z"),
|
||||
dailyCostCents: 1_000,
|
||||
resource: {
|
||||
id: "res_by",
|
||||
availability: { monday: 8, tuesday: 8, wednesday: 8, thursday: 8, friday: 8 },
|
||||
countryId: "country_de",
|
||||
federalState: "BY",
|
||||
metroCityId: "city_munich",
|
||||
country: { code: "DE" },
|
||||
metroCity: { name: "Munich" },
|
||||
},
|
||||
},
|
||||
]),
|
||||
},
|
||||
};
|
||||
|
||||
const result = await getDashboardBudgetForecast(db as never);
|
||||
|
||||
expect(result).toEqual([
|
||||
expect.objectContaining({
|
||||
projectId: "proj_1",
|
||||
shortCode: "ALPHA",
|
||||
spentCents: 1_000,
|
||||
remainingCents: 9_000,
|
||||
activeAssignmentCount: 0,
|
||||
calendarLocations: [],
|
||||
}),
|
||||
]);
|
||||
});
|
||||
|
||||
it("returns burn derivation and calendar basis for active project forecasts", async () => {
|
||||
vi.useFakeTimers();
|
||||
vi.setSystemTime(new Date("2026-01-15T00:00:00.000Z"));
|
||||
|
||||
try {
|
||||
const db = {
|
||||
project: {
|
||||
findMany: vi.fn().mockResolvedValue([
|
||||
{
|
||||
id: "proj_1",
|
||||
name: "Gelddruckmaschine",
|
||||
shortCode: "GDM",
|
||||
budgetCents: 100_000,
|
||||
startDate: new Date("2026-01-01T00:00:00.000Z"),
|
||||
endDate: new Date("2026-12-31T00:00:00.000Z"),
|
||||
clientId: "client_1",
|
||||
client: { name: "ACME" },
|
||||
},
|
||||
]),
|
||||
},
|
||||
assignment: {
|
||||
findMany: vi.fn().mockResolvedValue([
|
||||
{
|
||||
projectId: "proj_1",
|
||||
startDate: new Date("2026-01-05T00:00:00.000Z"),
|
||||
endDate: new Date("2026-01-06T00:00:00.000Z"),
|
||||
dailyCostCents: 1_000,
|
||||
resource: {
|
||||
id: "res_by",
|
||||
availability: { monday: 8, tuesday: 8, wednesday: 8, thursday: 8, friday: 8 },
|
||||
countryId: "country_de",
|
||||
federalState: "BY",
|
||||
metroCityId: "city_munich",
|
||||
country: { code: "DE", name: "Deutschland" },
|
||||
metroCity: { name: "Munich" },
|
||||
},
|
||||
},
|
||||
{
|
||||
projectId: "proj_1",
|
||||
startDate: new Date("2026-01-15T00:00:00.000Z"),
|
||||
endDate: new Date("2026-01-16T00:00:00.000Z"),
|
||||
dailyCostCents: 2_000,
|
||||
resource: {
|
||||
id: "res_hh",
|
||||
availability: { monday: 8, tuesday: 8, wednesday: 8, thursday: 8, friday: 8 },
|
||||
countryId: "country_de",
|
||||
federalState: "HH",
|
||||
metroCityId: "city_hamburg",
|
||||
country: { code: "DE", name: "Deutschland" },
|
||||
metroCity: { name: "Hamburg" },
|
||||
},
|
||||
},
|
||||
]),
|
||||
},
|
||||
};
|
||||
|
||||
const result = await getDashboardBudgetForecast(db as never);
|
||||
|
||||
expect(result).toEqual([
|
||||
expect.objectContaining({
|
||||
projectId: "proj_1",
|
||||
shortCode: "GDM",
|
||||
budgetCents: 100_000,
|
||||
spentCents: 5_000,
|
||||
remainingCents: 95_000,
|
||||
burnRate: 4_000,
|
||||
activeAssignmentCount: 1,
|
||||
calendarLocations: [
|
||||
expect.objectContaining({
|
||||
countryCode: "DE",
|
||||
countryName: "Deutschland",
|
||||
federalState: "HH",
|
||||
metroCityName: "Hamburg",
|
||||
activeAssignmentCount: 1,
|
||||
burnRateCents: 4_000,
|
||||
}),
|
||||
],
|
||||
}),
|
||||
]);
|
||||
} finally {
|
||||
vi.useRealTimers();
|
||||
}
|
||||
});
|
||||
|
||||
it("excludes regional public holidays from overview budget totals", async () => {
|
||||
const db = {
|
||||
assignment: {
|
||||
findMany: vi
|
||||
.fn()
|
||||
.mockResolvedValueOnce([])
|
||||
.mockResolvedValueOnce([
|
||||
{
|
||||
startDate: new Date("2026-01-05T00:00:00.000Z"),
|
||||
endDate: new Date("2026-01-06T00:00:00.000Z"),
|
||||
dailyCostCents: 1_000,
|
||||
resource: {
|
||||
id: "res_by",
|
||||
availability: { monday: 8, tuesday: 8, wednesday: 8, thursday: 8, friday: 8 },
|
||||
countryId: "country_de",
|
||||
federalState: "BY",
|
||||
metroCityId: "city_munich",
|
||||
country: { code: "DE" },
|
||||
metroCity: { name: "Munich" },
|
||||
},
|
||||
},
|
||||
]),
|
||||
},
|
||||
resource: {
|
||||
count: vi
|
||||
.fn()
|
||||
.mockResolvedValueOnce(1)
|
||||
.mockResolvedValueOnce(1),
|
||||
findMany: vi.fn().mockResolvedValue([{ chapter: "CGI", chargeabilityTarget: 80 }]),
|
||||
},
|
||||
project: {
|
||||
count: vi.fn().mockResolvedValue(1),
|
||||
findMany: vi.fn().mockResolvedValue([{ status: "ACTIVE", budgetCents: 10_000 }]),
|
||||
},
|
||||
demandRequirement: {
|
||||
findMany: vi.fn().mockResolvedValue([]),
|
||||
},
|
||||
auditLog: {
|
||||
findMany: vi.fn().mockResolvedValue([]),
|
||||
},
|
||||
};
|
||||
|
||||
const result = await getDashboardOverview(db as never);
|
||||
|
||||
expect(result.budgetSummary).toEqual({
|
||||
totalBudgetCents: 10_000,
|
||||
totalCostCents: 1_000,
|
||||
avgUtilizationPercent: 10,
|
||||
});
|
||||
});
|
||||
|
||||
it("excludes regional public holidays from project health budget usage", async () => {
|
||||
const db = {
|
||||
project: {
|
||||
findMany: vi.fn().mockResolvedValue([
|
||||
{
|
||||
id: "proj_1",
|
||||
name: "Alpha",
|
||||
shortCode: "ALPHA",
|
||||
budgetCents: 10_000,
|
||||
endDate: new Date("2026-12-31T00:00:00.000Z"),
|
||||
clientId: null,
|
||||
client: null,
|
||||
demandRequirements: [],
|
||||
},
|
||||
]),
|
||||
},
|
||||
assignment: {
|
||||
findMany: vi.fn().mockResolvedValue([
|
||||
{
|
||||
projectId: "proj_1",
|
||||
startDate: new Date("2026-01-05T00:00:00.000Z"),
|
||||
endDate: new Date("2026-01-06T00:00:00.000Z"),
|
||||
dailyCostCents: 1_000,
|
||||
resource: {
|
||||
id: "res_by",
|
||||
availability: { monday: 8, tuesday: 8, wednesday: 8, thursday: 8, friday: 8 },
|
||||
countryId: "country_de",
|
||||
federalState: "BY",
|
||||
metroCityId: "city_munich",
|
||||
country: { code: "DE" },
|
||||
metroCity: { name: "Munich" },
|
||||
},
|
||||
},
|
||||
]),
|
||||
},
|
||||
};
|
||||
|
||||
const result = await getDashboardProjectHealth(db as never);
|
||||
|
||||
expect(result).toEqual([
|
||||
expect.objectContaining({
|
||||
shortCode: "ALPHA",
|
||||
budgetHealth: 90,
|
||||
spentCents: 1_000,
|
||||
budgetUtilizationPercent: 10,
|
||||
calendarLocations: [
|
||||
expect.objectContaining({
|
||||
countryCode: "DE",
|
||||
federalState: "BY",
|
||||
metroCityName: "Munich",
|
||||
assignmentCount: 1,
|
||||
spentCents: 1_000,
|
||||
}),
|
||||
],
|
||||
}),
|
||||
]);
|
||||
});
|
||||
|
||||
it("returns distinct resource counts for chapter demand grouping", async () => {
|
||||
const db = {
|
||||
demandRequirement: {
|
||||
@@ -606,14 +1116,21 @@ describe("dashboard use-cases", () => {
|
||||
});
|
||||
|
||||
expect(result).toEqual([
|
||||
{
|
||||
expect.objectContaining({
|
||||
id: "CGI",
|
||||
name: "CGI",
|
||||
shortCode: "CGI",
|
||||
allocatedHours: 19,
|
||||
requiredFTEs: 0,
|
||||
resourceCount: 2,
|
||||
},
|
||||
derivation: expect.objectContaining({
|
||||
periodWorkingHoursBase: 176,
|
||||
requiredHours: null,
|
||||
fillPct: null,
|
||||
demandSource: "NONE",
|
||||
calendarLocations: [],
|
||||
}),
|
||||
}),
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -738,14 +1255,21 @@ describe("dashboard use-cases", () => {
|
||||
});
|
||||
|
||||
expect(result).toEqual([
|
||||
{
|
||||
expect.objectContaining({
|
||||
id: "proj_1",
|
||||
name: "Alpha",
|
||||
shortCode: "ALPHA",
|
||||
allocatedHours: 18,
|
||||
requiredFTEs: 3.5,
|
||||
resourceCount: 3,
|
||||
},
|
||||
derivation: expect.objectContaining({
|
||||
periodWorkingHoursBase: 176,
|
||||
requiredHours: 616,
|
||||
fillPct: 3,
|
||||
demandSource: "DEMAND_REQUIREMENTS",
|
||||
calendarLocations: [],
|
||||
}),
|
||||
}),
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -802,14 +1326,20 @@ describe("dashboard use-cases", () => {
|
||||
});
|
||||
|
||||
expect(result).toEqual([
|
||||
{
|
||||
expect.objectContaining({
|
||||
id: "proj_1",
|
||||
name: "Alpha",
|
||||
shortCode: "ALPHA",
|
||||
allocatedHours: 8,
|
||||
requiredFTEs: 2,
|
||||
resourceCount: 1,
|
||||
},
|
||||
derivation: expect.objectContaining({
|
||||
periodWorkingHoursBase: 176,
|
||||
requiredHours: 352,
|
||||
fillPct: 2,
|
||||
demandSource: "DEMAND_REQUIREMENTS",
|
||||
}),
|
||||
}),
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -865,14 +1395,20 @@ describe("dashboard use-cases", () => {
|
||||
});
|
||||
|
||||
expect(result).toEqual([
|
||||
{
|
||||
expect.objectContaining({
|
||||
id: "proj_1",
|
||||
name: "Alpha",
|
||||
shortCode: "ALPHA",
|
||||
allocatedHours: 16,
|
||||
requiredFTEs: 2,
|
||||
resourceCount: 1,
|
||||
},
|
||||
derivation: expect.objectContaining({
|
||||
periodWorkingHoursBase: 176,
|
||||
requiredHours: 352,
|
||||
fillPct: 5,
|
||||
demandSource: "PROJECT_STAFFING_REQS",
|
||||
}),
|
||||
}),
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -270,6 +270,7 @@ describe("demand and assignment use-cases", () => {
|
||||
|
||||
const db = {
|
||||
demandRequirement: { findUnique: demandRequirementFindUnique },
|
||||
assignment: { findMany: assignmentFindMany },
|
||||
resource: { findUnique: resourceFindUnique },
|
||||
$transaction: vi.fn(async (callback) =>
|
||||
callback({
|
||||
@@ -437,6 +438,7 @@ describe("demand and assignment use-cases", () => {
|
||||
|
||||
const db = {
|
||||
demandRequirement: { findUnique: demandRequirementFindUnique },
|
||||
assignment: { findMany: assignmentFindMany },
|
||||
resource: { findUnique: resourceFindUnique },
|
||||
$transaction: vi.fn(async (callback) =>
|
||||
callback({
|
||||
@@ -555,6 +557,7 @@ describe("demand and assignment use-cases", () => {
|
||||
|
||||
const db = {
|
||||
demandRequirement: { findUnique: demandRequirementFindUnique },
|
||||
assignment: { findMany: assignmentFindMany },
|
||||
$transaction: vi.fn(async (callback) =>
|
||||
callback({
|
||||
project: { findUnique: projectFindUnique },
|
||||
@@ -685,7 +688,7 @@ describe("demand and assignment use-cases", () => {
|
||||
|
||||
const db = {
|
||||
demandRequirement: { findUnique: demandRequirementFindUnique },
|
||||
assignment: { findUnique: assignmentFindUnique },
|
||||
assignment: { findUnique: assignmentFindUnique, findMany: assignmentFindMany },
|
||||
resource: { findUnique: resourceFindUnique },
|
||||
$transaction: vi.fn(async (callback) =>
|
||||
callback({
|
||||
@@ -805,7 +808,7 @@ describe("demand and assignment use-cases", () => {
|
||||
findMany: allocationFindMany,
|
||||
},
|
||||
demandRequirement: { findUnique: demandRequirementFindUnique },
|
||||
assignment: { findUnique: assignmentFindUnique },
|
||||
assignment: { findUnique: assignmentFindUnique, findMany: assignmentFindMany },
|
||||
resource: { findUnique: resourceFindUnique },
|
||||
$transaction: vi.fn(async (callback) =>
|
||||
callback({
|
||||
@@ -966,7 +969,7 @@ describe("demand and assignment use-cases", () => {
|
||||
findMany: allocationFindMany,
|
||||
},
|
||||
demandRequirement: { findUnique: demandRequirementFindUnique },
|
||||
assignment: { findUnique: assignmentFindUnique },
|
||||
assignment: { findUnique: assignmentFindUnique, findMany: assignmentFindMany },
|
||||
resource: { findUnique: resourceFindUnique },
|
||||
$transaction: vi.fn(async (callback) =>
|
||||
callback({
|
||||
@@ -1102,7 +1105,7 @@ describe("demand and assignment use-cases", () => {
|
||||
demandRequirement: {
|
||||
findUnique: demandRequirementFindUnique,
|
||||
},
|
||||
assignment: { findUnique: assignmentFindUnique },
|
||||
assignment: { findUnique: assignmentFindUnique, findMany: assignmentFindMany },
|
||||
auditLog: { create: auditLogCreate },
|
||||
$transaction: vi.fn(async (callback) =>
|
||||
callback({
|
||||
@@ -1227,7 +1230,7 @@ describe("demand and assignment use-cases", () => {
|
||||
demandRequirement: {
|
||||
findUnique: demandRequirementFindUnique,
|
||||
},
|
||||
assignment: { findUnique: assignmentFindUnique },
|
||||
assignment: { findUnique: assignmentFindUnique, findMany: assignmentFindMany },
|
||||
auditLog: { create: auditLogCreate },
|
||||
$transaction: vi.fn(async (callback) =>
|
||||
callback({
|
||||
|
||||
Reference in New Issue
Block a user