import AuthHeader from '../auth-header';
import { mockFailureResponse } from '../../../../mocks/server';
import { renderWithClient } from '../../../../utils/test/react-query';
import { MemoryRouter } from 'react-router-dom';

describe('AuthHeader component', () => {
  test('successful query component', async () => {
    const result = renderWithClient(<AuthHeader />, MemoryRouter);

    expect(await result.findByText(/تست/i)).toBeInTheDocument();
    expect(await result.findByText(/خروج/i)).toBeInTheDocument();
  });

  test('failure query component', async () => {
    mockFailureResponse();
    const result = renderWithClient(<AuthHeader />, MemoryRouter);

    expect(await result.findByText(/ورود/i)).toBeInTheDocument();
  });
});
