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

describe("LoadingSpinner", () => {
  it("renders without crashing", () => {
    render(<LoadingSpinner />);
    expect(screen.getByRole("status")).toBeInTheDocument();
  });

  it("displays loading image", () => {
    render(<LoadingSpinner />);
    const img = screen.getByAltText("Loading...");
    expect(img).toBeInTheDocument();
    expect(img).toHaveAttribute("src", "/icon.jpg");
  });

  it("has spinning animation class", () => {
    render(<LoadingSpinner />);
    const img = screen.getByAltText("Loading...");
    expect(img).toHaveClass("animate-spin");
  });
});
