/* eslint-disable no-multi-assign */
import React from 'react';
import { render, cleanup, waitFor } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import getOperatorData from '../../../../../../../tests/factories/pages/operator.factory';
import TemplateThree from '.';

describe('Operator template three component', () => {
  const data = getOperatorData();

  test('Template Three Status Active', () => {
    const { container, getByText } = render(<TemplateThree {...data} />);
    expect(getByText('Ice Casino')).toBeTruthy();
    expect(container.querySelectorAll('h1')).toHaveLength(1);
    expect(getByText('New')).toBeTruthy();
    expect(container.querySelectorAll('a')).toHaveLength(3);
    expect(getByText('100% Bonus')).toBeTruthy();
    expect(getByText('+ Big Promotions')).toBeTruthy();
    expect(container.querySelectorAll('ul')).toHaveLength(1);
    expect(container.querySelectorAll('li')).toHaveLength(6);
  });
  test('Template Three variable component', async () => {
    const { container } = render(<TemplateThree {...data} hasVariableComponent />);

    await waitFor(() => {
      expect(container.querySelector('.variable')).toBeTruthy();
    });
  });
});

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