import { describe, expect, it } from "vitest";
import {
  buildTimelineEntriesDetailInput,
} from "../router/timeline-read-shared.js";

describe("timeline read shared", () => {
  it("builds detail input from period and normalized filters", () => {
    expect(
      buildTimelineEntriesDetailInput({
        startDate: "2026-04-01",
        durationDays: 3,
        resourceIds: [" resource_1 ", ""],
        projectIds: ["project_1"],
        chapters: [" Compositing "],
      }),
    ).toEqual({
      period: {
        startDate: new Date("2026-04-01T00:00:00.000Z"),
        endDate: new Date("2026-04-03T00:00:00.000Z"),
      },
      filters: {
        resourceIds: ["resource_1"],
        projectIds: ["project_1"],
        clientIds: undefined,
        chapters: ["Compositing"],
        eids: undefined,
        countryCodes: undefined,
      },
      timelineInput: {
        startDate: new Date("2026-04-01T00:00:00.000Z"),
        endDate: new Date("2026-04-03T00:00:00.000Z"),
        resourceIds: ["resource_1"],
        projectIds: ["project_1"],
        clientIds: undefined,
        chapters: ["Compositing"],
        eids: undefined,
        countryCodes: undefined,
      },
    });
  });

});
