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

import OperatorInfoBlock from '.';

describe('operatorInfoBlock Component', () => {
  test('render  with props', () => {
    const { container, getByText } = render(
      <OperatorInfoBlock
        page={{
          relation: {
            url: 'http://google.com',
            owner: 'Alphabet',
            founded: '1999',
            support_types: ' hello live chat world',
            types: ['live', 'poker', 'foo', 'bar'],
            games_amount: '+1000',
            status: 'active',
          },
        }}
      />
    );
    expect(container.querySelectorAll('li')).toHaveLength(6);
    expect(getByText('http://google.com')).toBeTruthy();
    expect(getByText('Owner')).toBeTruthy();
    expect(getByText('Number of Games')).toBeTruthy();
    expect(getByText('Alphabet')).toBeTruthy();
    expect(getByText('No')).toBeTruthy();
    expect(getByText('Yes')).toBeTruthy();
  });

  test('activeOperator flase', () => {
    const { container } = render(
      <OperatorInfoBlock page={{ relation: { status: 'coming_soon' } }} />
    );
    expect(container).toBeEmptyDOMElement();
  });
});
afterEach(() => {
  cleanup();
});
