import { renderWithClient } from '../../../utils/test/react-query';
import { MemoryRouter } from 'react-router-dom';
import DefaultPage from '../index';
import { expectPageTestIds } from '../../../utils/test/expects';
import { mockFailureResponse } from '../../../mocks/server';

describe('DefaultPage component', () => {
  test('successful render page', async () => {
    const result = renderWithClient(<DefaultPage />, MemoryRouter);
    await expectPageTestIds(result);
  });

  test('not redirect to login with not authenticated user', async () => {
    mockFailureResponse();
    renderWithClient(<DefaultPage />, MemoryRouter);
    expect(window.location.pathname).not.toBe('/login');
  });
});
