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

describe('Payment template one three component', () => {
  const data = getPaymentData();

  test('Template One Status Active', () => {
    const { container, getByText } = render(<TemplateOneThree {...data} />);
    expect(getByText('Next')).toBeTruthy();
    expect(container.querySelectorAll('h1')).toHaveLength(1);
    expect(getByText('20 Free Spins No Deposit Bonus')).toBeTruthy();
    expect(getByText('+ 300% & 555 Spins Welcome Bonus')).toBeTruthy();
    expect(getByText('Visit')).toBeTruthy();
    expect(container.querySelectorAll('a')).toHaveLength(2);
    expect(container.getElementsByClassName('desc')).toBeTruthy();
    expect(container.querySelectorAll('li')).toHaveLength(4);
  });

  test('Template Three Status Active', () => {
    const { container, getByText } = render(
      <TemplateOneThree {...data} template="template_three" />
    );
    expect(getByText('Next')).toBeTruthy();
    expect(container.querySelectorAll('h1')).toHaveLength(1);
    expect(getByText('20 Free Spins No Deposit Bonus')).toBeTruthy();
    expect(getByText('+ 300% & 555 Spins Welcome Bonus')).toBeTruthy();
    expect(getByText('Visit')).toBeTruthy();
    expect(container.querySelectorAll('a')).toHaveLength(2);
    expect(container.getElementsByClassName('desc')).toBeTruthy();
    expect(container.querySelectorAll('li')).toHaveLength(4);
  });
});

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