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

import OneStar from './one-star';

describe('OneStar Component', () => {
  test('render container with correct rating', async () => {
    const { getByText } = render(<OneStar showLabel numOfStars={5} rating={3} />);

    expect(getByText('Rating', { exact: false })).toBeTruthy();
    expect(getByText('3', { exact: false })).toBeTruthy();
    expect(getByText('5', { exact: false })).toBeTruthy();
  });
});

afterEach(() => {
  cleanup();
});
