import { render, screen } from "@testing-library/react";
import { describe, it, expect } from "vitest";
import { BackButton } from "./BackButton";
import React from "react";

describe("BackButton", () => {
  it("renders correctly with given label and href", () => {
    render(<BackButton label="Go back" href="/auth/login" />);

    const link = screen.getByRole("link", { name: "Go back" });
    expect(link).toBeInTheDocument();
    expect(link).toHaveAttribute("href", "/auth/login");
  });

  it("applies the correct styles for a link button", () => {
    render(<BackButton label="Go back" href="/auth/login" />);

    const link = screen.getByRole("link", { name: "Go back" });
    // It uses Button with variant="link"
    expect(link).toHaveClass("text-primary");
    expect(link).toHaveClass("underline-offset-4");
    expect(link).toHaveClass("hover:underline");
  });
});
