// @vitest-environment jsdom
import { describe, it, expect, vi } from "vitest";
import { render, screen } from "@testing-library/react";
import { BoardingPanel } from "./BoardingPanel.js";
import type { IFlightTransitionItem } from "../../types.js";

vi.mock("@/i18n/provider.js", () => ({
  useTranslation: () => ({ t: (k: string) => k }),
}));

const baseItem: IFlightTransitionItem = {
  start: {
    dayChange: { value: 0, title: "" },
    local: "11:00",
    localTime: "11:00",
    tzOffset: 3,
    utc: "08:00",
  },
  end: {
    dayChange: { value: 0, title: "" },
    local: "11:30",
    localTime: "11:30",
    tzOffset: 3,
    utc: "08:30",
  },
  status: "Finished",
  isActual: true,
};

describe("BoardingPanel", () => {
  it("renders start and end times", () => {
    render(<BoardingPanel item={baseItem} />);
    expect(screen.getByText("11:00")).toBeTruthy();
    expect(screen.getByText("11:30")).toBeTruthy();
  });

  it("renders status label", () => {
    render(<BoardingPanel item={baseItem} />);
    expect(screen.getByText("DETAILS.STATUS_FINISHED")).toBeTruthy();
  });

  it("has data-testid", () => {
    render(<BoardingPanel item={baseItem} />);
    expect(screen.getByTestId("boarding-panel")).toBeTruthy();
  });
});
