import { afterEach, describe, expect, it, vi } from "vitest"; import { render, screen } from "@testing-library/react"; import { BrowserRouter } from "react-router"; import { DraftInfoCard, type DraftInfoCardProps } from "../DraftInfoCard"; function renderWithRouter(ui: React.ReactElement) { return render({ui}); } const baseProps: DraftInfoCardProps = { draftRounds: 8, draftTimerMode: "chess_clock", draftInitialTime: 28800, draftIncrementTime: 1800, sportsCount: 6, isDraftOrderSet: true, isDraftOrPreDraft: true, draftDateTime: new Date("2026-05-21T04:00:00.000Z"), draftTimezone: "America/Los_Angeles", draftBoardHref: "/leagues/1/draft-board/1", draftRoomHref: "/leagues/1/draft/1", }; describe("DraftInfoCard", () => { afterEach(() => { vi.useRealTimers(); }); it("shows the full draft date and relative timing before the draft", () => { vi.useFakeTimers(); vi.setSystemTime(new Date("2026-05-18T04:00:00.000Z")); renderWithRouter(); expect(screen.getByText("Draft Date & Time")).toBeInTheDocument(); expect(screen.getByText("May 20, 2026 9:00PM PT")).toBeInTheDocument(); expect(screen.getByText("In 3 days")).toBeInTheDocument(); }); it("describes chess clock bank and increment in human terms", () => { renderWithRouter(); expect(screen.getByText("8 hour time bank")).toBeInTheDocument(); expect(screen.getByText("+30 minute increment")).toBeInTheDocument(); }); it("describes standard timers in human terms", () => { renderWithRouter( ); expect(screen.getByText("30 seconds")).toBeInTheDocument(); expect(screen.getByText("per pick")).toBeInTheDocument(); }); it("formats the draft date in the provided timezone", () => { renderWithRouter( ); expect(screen.getByText("May 21, 2026 12:00AM ET")).toBeInTheDocument(); }); });