import React from 'react';
import { render, cleanup } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';

/* eslint-disable react/prop-types */

import TopList from '.';
import { getListToplistItems } from '~tests/factories/modules/toplist.factory';

describe('Organisms/TopList', () => {
  test('render with props', () => {
    const { container } = render(<TopList module={{ items: getListToplistItems(1) }} />);
    expect(container).toBeTruthy();
    expect(container.querySelector('.list')).toBeTruthy();
  });
  test('headerExtra', () => {
    const { container } = render(
      <TopList
        module={{ items: getListToplistItems(1) }}
        toplistHeading={<div className="my-header" />}
      />
    );
    expect(container.querySelector('.my-header')).toBeTruthy();
  });
});
afterEach(() => {
  cleanup();
});
