import { describe, expect, it } from "vitest"
import { dateKeyTZ, isAtHourTZ } from "@/lib/time"

describe("time tz helpers", () => {
  it("computes date key in timezone", () => {
    const d = new Date("2025-10-07T10:30:00.000Z")
    const key = dateKeyTZ(d, "America/Sao_Paulo")
    // 2025-10-07 07:30 in Sao Paulo (UTC-3)
    expect(key).toBe("2025-10-07")
  })

  it("matches hour in timezone", () => {
    const d = new Date("2025-10-07T11:00:00.000Z") // 08:00 BRT (no DST)
    expect(isAtHourTZ(d, "America/Sao_Paulo", 8)).toBe(true)
  })
})
