fix(test): use relative dates in insights summary test

Hardcoded dates (2026-03-20 / 2026-04-05) were now in the past, causing
the demand window filter (endDate >= now) to exclude the mock demand
requirement and miss the expected staffing anomaly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-06 09:40:14 +02:00
parent 8f464f2150
commit d2caba8d7c
@@ -43,26 +43,30 @@ describe("assistant insights summary tools", () => {
});
it("routes insights summary reads through the insights router path", async () => {
const now = new Date();
const daysAgo = (n: number) => new Date(now.getTime() - n * 24 * 60 * 60 * 1000);
const daysFromNow = (n: number) => new Date(now.getTime() + n * 24 * 60 * 60 * 1000);
const db = {
project: {
findMany: vi.fn().mockResolvedValue([
{
budgetCents: 100_000,
startDate: new Date("2026-03-01T00:00:00.000Z"),
endDate: new Date("2026-03-31T00:00:00.000Z"),
startDate: daysAgo(30),
endDate: daysFromNow(30),
demandRequirements: [
{
headcount: 3,
startDate: new Date("2026-03-20T00:00:00.000Z"),
endDate: new Date("2026-04-05T00:00:00.000Z"),
startDate: daysAgo(5),
endDate: daysFromNow(10),
_count: { assignments: 1 },
},
],
assignments: [
{
resourceId: "res_1",
startDate: new Date("2026-03-01T00:00:00.000Z"),
endDate: new Date("2026-03-31T00:00:00.000Z"),
startDate: daysAgo(30),
endDate: daysFromNow(30),
hoursPerDay: 8,
dailyCostCents: 10_000,
status: "ACTIVE",