import * as React from 'react';
import { render } from '@testing-library/react';
import Healthscore from '.';

describe('<Healthscore />', () => {
  describe('small healthscores', () => {
    it('renders a healthy healthscore', () => {
      const { container } = render(<Healthscore score="100" size="small" />);
      expect(container.textContent).toMatchSnapshot();
    });

    it('renders a average healthscore', () => {
      const { container } = render(<Healthscore score="80" size="small" />);
      expect(container.textContent).toMatchSnapshot();
    });

    it('renders a poor healthscore', () => {
      const { container } = render(<Healthscore score="49" size="small" />);
      expect(container.textContent).toMatchSnapshot();
    });

    it('renders a processing healthscore', () => {
      const { container } = render(<Healthscore isProcessing size="small" />);
      expect(container.textContent).toMatchSnapshot();
    });

    it('renders a NA healthscore', () => {
      const { container } = render(<Healthscore score={undefined} size="small" />);
      expect(container.textContent).toMatchSnapshot();
    });
  });

  describe('large healthscores', () => {
    it('renders a healthy healthscore', () => {
      const { container } = render(<Healthscore score="100" size="large" />);
      expect(container.textContent).toMatchSnapshot();
    });

    it('renders a average healthscore', () => {
      const { container } = render(<Healthscore score="80" size="large" />);
      expect(container.textContent).toMatchSnapshot();
    });

    it('renders a poor healthscore', () => {
      const { container } = render(<Healthscore score="49" size="large" />);
      expect(container.textContent).toMatchSnapshot();
    });

    it('renders a processing healthscore', () => {
      const { container } = render(<Healthscore isProcessing size="large" />);
      expect(container.textContent).toMatchSnapshot();
    });

    it('renders a NA healthscore', () => {
      const { container } = render(<Healthscore score={undefined} size="large" />);
      expect(container.textContent).toMatchSnapshot();
    });
  });
});
