import { describe, it, expect } from "vitest";
import { defaultReferencePeriod } from "./referencePeriod";

describe("defaultReferencePeriod", () => {
  it("returns the month before the given date", () => {
    expect(defaultReferencePeriod(new Date(2026, 3, 15))).toEqual({ year: 2026, month: 3 });
  });

  it("wraps January back to December of the previous year", () => {
    expect(defaultReferencePeriod(new Date(2026, 0, 10))).toEqual({ year: 2025, month: 12 });
  });

  it("handles the last day of a month", () => {
    expect(defaultReferencePeriod(new Date(2026, 5, 30))).toEqual({ year: 2026, month: 5 });
  });
});
