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

describe('Payment Header template two  component', () => {
  const data = getPaymentData();

  test('Payment Template two Active', () => {
    const { container, queryByText } = render(<TemplateTwo {...data} />);
    expect(queryByText('Next')).toBeInTheDocument();
    expect(container.querySelectorAll('h1')).toHaveLength(1);
    expect(queryByText('20 Free Spins No Deposit Bonus')).toBeInTheDocument();
    expect(queryByText('+ 300% & 555 Spins Welcome Bonus')).toBeInTheDocument();
    expect(queryByText('Visit')).toBeInTheDocument();
    expect(container.querySelectorAll('a')).toHaveLength(1);
    expect(container.getElementsByClassName('desc')).toHaveLength(1);

    const description = container.querySelector('.desc');
    fireEvent.click(description);

    expect(container.getElementsByClassName('open').length).toEqual(1);
    

  });
});

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