import React from 'react';
import { render } from '@testing-library/react';
import OperatorSummary from '.';

const mockPage = {
  reviewer: {},
  relation_type: 'operator',
  extra_fields: {},
  template: 'operator',
  relation: {
    name: 'Rizk',
    logo_url: 'logo.png',
    bonuses: {
      main: {
        one_liner: 'test one liner',
        terms_and_conditions_enabled: true,
        terms_and_conditions: 'test tncs',
      },
    },
  },
};

test('renders with default props', () => {
  const { getByText, getByAltText } = render(<OperatorSummary page={mockPage} />);

  expect(getByText('Expert Casino Review Rizk')).toBeInTheDocument();
  expect(getByAltText('Rizk')).toBeInTheDocument();
});

test('renders with custom props', () => {
  const { getByText, getByAltText } = render(
    <OperatorSummary page={mockPage} imgWidth={200} imgHeight="200px" />
  );

  expect(getByText('Expert Casino Review Rizk')).toBeInTheDocument();
  expect(getByAltText('Rizk')).toBeInTheDocument();
  expect(document.querySelector('.description')).not.toBeInTheDocument();
});
