import React from 'react';
import { render, cleanup } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';

import NumberRating from '.';

describe('NumberRating Component', () => {
  test('render 3.5/5 rate with props', () => {
    const { container, getByText } = render(<NumberRating total={5} rating={3.25} />);
    expect(container.querySelector('.numberRatingContainer')).toBeTruthy();
    expect(getByText('3.5/5')).toBeTruthy();
  });

  test('render with an array of rates ', () => {
    const { getByText } = render(<NumberRating total={10} rating={[5, 6, 7, 6.3]} />);
    expect(getByText('6/10')).toBeTruthy();
  });
});
afterEach(() => {
  cleanup();
});
