import React from 'react';
import { render, screen } from '@testing-library/react';
import Loader from './Loader';

describe('Loader Component', () => {
  test('should render loader element', () => {
    render(<Loader />);
    const loaderElement = screen.getByRole('status', { hidden: true });
    expect(loaderElement).toBeInTheDocument();
  });

  test('should have loader class', () => {
    render(<Loader />);
    expect(screen.getByTestId('loader')).toHaveClass('loader');
  });

  test('should render without props', () => {
    render(<Loader />);
    expect(screen.getByTestId('loader')).toBeInTheDocument();
  });

  test('should render multiple loaders if needed', () => {
    render(
      <>
        <Loader />
        <Loader />
      </>
    );
    expect(screen.getAllByTestId('loader')).toHaveLength(2);
  });
});
