/* eslint-disable no-multi-assign */
import React from 'react';
import { render, cleanup } from '@testing-library/react';
import MainProvider from '~context/MainProvider';
import '@testing-library/jest-dom/extend-expect';
import getAuthorList from '~tests/factories/authors/author.factory';
import TemplateOne from '.';

describe('Author Header', () => {
  test('Template One', () => {
    const author = getAuthorList({})[1];
    const { container, getByText } = render(
      <MainProvider value={{}}>
        <TemplateOne author={author} />
      </MainProvider>
    );
    expect(getByText('Author 1 Name')).toBeTruthy();
    expect(getByText('Sports Betting')).toBeTruthy();
    expect(getByText('Author 1 Biography')).toBeTruthy();
    expect(container.querySelectorAll('a')).toHaveLength(6);
    expect(container.querySelectorAll('ul')).toHaveLength(1);
    expect(container.querySelectorAll('li')).toHaveLength(3);
  });
});

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