import { describe, it, expect } from "vitest";
import { render, screen } from "@testing-library/react";
import { BookingCancelledPage } from "../pages/BookingCancelled.tsx";

describe("BookingCancelledPage", () => {
  it("renders the cancelled heading", () => {
    render(<BookingCancelledPage />);
    expect(screen.getByRole("heading", { name: /Appointment Cancelled/i })).toBeInTheDocument();
  });

  it("renders the cancelled body text", () => {
    render(<BookingCancelledPage />);
    expect(screen.getByText(/Your appointment has been cancelled/i)).toBeInTheDocument();
  });

  it("has a Book again link pointing to /admin/book", () => {
    render(<BookingCancelledPage />);
    const link = screen.getByRole("link", { name: /Book again/i });
    expect(link).toHaveAttribute("href", "/admin/book");
  });

  it("has a Back to Portal link pointing to /", () => {
    render(<BookingCancelledPage />);
    const link = screen.getByRole("link", { name: /Back to Portal/i });
    expect(link).toHaveAttribute("href", "/");
  });
});
