/* eslint-env jest */

import React from 'react';
import { render, cleanup } from 'react-testing-library';
import Spinner from './Spinner';

beforeEach(cleanup);

it('does not include title when not provided', () => {
  const { queryByText } = render(
    <Spinner description="test spinner description" />
  );
  expect(queryByText('Title')).toBeNull();
});

it('includes title when provided', () => {
  const { getByText } = render(<Spinner title="Test spinner" />);
  const title = getByText('Test spinner');
  expect(title).not.toBeNull();
});

it('does not include desc when not provided', () => {
  const { queryByText } = render(<Spinner title="Test spinner" />);
  expect(queryByText('test spinner description')).toBeNull();
});

it('includes desc when not provided', () => {
  const { getByText } = render(
    <Spinner description="test spinner description" />
  );
  const desc = getByText('test spinner description');
  expect(desc).not.toBeNull();
});

Add tests to Spinner component
Update: Add tests to Spinner component
