import { renderWithClient } from '../../../../utils/test/react-query';
import { MemoryRouter } from 'react-router-dom';
import MainLayout from '../index';
import { expectPageTestIds, expectPageTitle } from '../../../../utils/test/expects';

describe('MainLayout component', () => {
  test('successful render component', async () => {
    const title = 'title';
    const result = renderWithClient(
      <MainLayout loginRequired={false} title={title} />,
      MemoryRouter
    );
    await expectPageTitle(title);
    await expectPageTestIds(result);
  });

  test('successful render loader component', async () => {
    const result = renderWithClient(<MainLayout loginRequired />, MemoryRouter);
    expect(await result.findByTestId('loader')).toBeInTheDocument();
  });
});
