import { describe, expect, it } from "vitest";
import {
  formatHeaderDataTime,
  getMsUntilNextHeaderDataTimeTick
} from "./use-workbench-runtime-data";

describe("workbench runtime data", () => {
  it("snaps the header time to the current five-minute interval", () => {
    expect(formatHeaderDataTime(new Date(2026, 6, 22, 15, 43, 31))).toBe("2026-07-22 15:40");
  });

  it("schedules the next header refresh on the next interval boundary", () => {
    expect(getMsUntilNextHeaderDataTimeTick(new Date(2026, 6, 22, 15, 43, 30))).toBe(90_000);
  });
});
