import { describe, expect, it } from "vitest"; import { buildTimelineBatchShiftAuditChanges, shiftTimelineAllocationWindow, } from "../router/timeline-allocation-batch-shift-support.js"; describe("timeline allocation batch shift support", () => { it("shifts and clamps allocation windows for each batch-shift mode", () => { expect( shiftTimelineAllocationWindow({ startDate: new Date("2026-04-10T00:00:00.000Z"), endDate: new Date("2026-04-12T00:00:00.000Z"), daysDelta: 2, mode: "move", }), ).toEqual({ startDate: new Date("2026-04-12T00:00:00.000Z"), endDate: new Date("2026-04-14T00:00:00.000Z"), }); expect( shiftTimelineAllocationWindow({ startDate: new Date("2026-04-10T00:00:00.000Z"), endDate: new Date("2026-04-12T00:00:00.000Z"), daysDelta: 5, mode: "resize-start", }), ).toEqual({ startDate: new Date("2026-04-12T00:00:00.000Z"), endDate: new Date("2026-04-12T00:00:00.000Z"), }); expect( shiftTimelineAllocationWindow({ startDate: new Date("2026-04-10T00:00:00.000Z"), endDate: new Date("2026-04-12T00:00:00.000Z"), daysDelta: -5, mode: "resize-end", }), ).toEqual({ startDate: new Date("2026-04-10T00:00:00.000Z"), endDate: new Date("2026-04-10T00:00:00.000Z"), }); }); it("builds batch-shift audit payloads", () => { expect( buildTimelineBatchShiftAuditChanges({ mode: "move", daysDelta: 3, count: 2, }), ).toEqual({ operation: "batchShift", mode: "move", daysDelta: 3, count: 2, }); }); });