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 () => { 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 = { const db = {
project: { project: {
findMany: vi.fn().mockResolvedValue([ findMany: vi.fn().mockResolvedValue([
{ {
budgetCents: 100_000, budgetCents: 100_000,
startDate: new Date("2026-03-01T00:00:00.000Z"), startDate: daysAgo(30),
endDate: new Date("2026-03-31T00:00:00.000Z"), endDate: daysFromNow(30),
demandRequirements: [ demandRequirements: [
{ {
headcount: 3, headcount: 3,
startDate: new Date("2026-03-20T00:00:00.000Z"), startDate: daysAgo(5),
endDate: new Date("2026-04-05T00:00:00.000Z"), endDate: daysFromNow(10),
_count: { assignments: 1 }, _count: { assignments: 1 },
}, },
], ],
assignments: [ assignments: [
{ {
resourceId: "res_1", resourceId: "res_1",
startDate: new Date("2026-03-01T00:00:00.000Z"), startDate: daysAgo(30),
endDate: new Date("2026-03-31T00:00:00.000Z"), endDate: daysFromNow(30),
hoursPerDay: 8, hoursPerDay: 8,
dailyCostCents: 10_000, dailyCostCents: 10_000,
status: "ACTIVE", status: "ACTIVE",