import { describe, expect, it } from "vitest";
import { createLineSegments } from "./App";

describe("grafsegmenter", () => {
  it("lager striplet horisontal startlinje og stripler hull på minst tre dager", () => {
    const day = 24 * 60 * 60 * 1000;
    const segments = createLineSegments(
      [
        { x: 20, y: 50, time: 0 },
        { x: 40, y: 40, time: day },
        { x: 100, y: 20, time: 4 * day }
      ],
      0
    );

    expect(segments[0]).toMatchObject({ x1: 0, x2: 20, y1: 50, y2: 50, dashed: true });
    expect(segments[1].dashed).toBe(false);
    expect(segments[2].dashed).toBe(true);
    expect(segments[2]).toMatchObject({ x1: 40, y1: 40, x2: 100, y2: 20 });
  });
});
