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

import { Spinner } from './Spinner';

describe('Spinner', () => {
  it('Should render the spinner', async () => {
    render(<Spinner />);

    expect(screen.getByLabelText('Loading')).toBeInTheDocument();
  });

  it('Should render the loading spinner with the custom aria label', async () => {
    render(<Spinner label="Loading sources" />);

    expect(screen.getByLabelText('Loading sources')).toBeInTheDocument();
  });
});
