import { describe, it, expect, vi } from 'vitest';
import { render, screen } from '@testing-library/react';
import { MemoryRouter } from 'react-router-dom';
import { AuthRoutes } from './routes';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { LoginPage } from './pages/LoginPage';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { RegisterPage } from './pages/RegisterPage';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { ForgotPasswordPage } from './pages/ForgotPasswordPage';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { ResetPasswordPage } from './pages/ResetPasswordPage';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { VerifyEmailPage } from './pages/VerifyEmailPage';

// Mock the pages to avoid complex dependencies
vi.mock('./pages/LoginPage', () => ({
  LoginPage: () => <div>LoginPage</div>,
}));

vi.mock('./pages/RegisterPage', () => ({
  RegisterPage: () => <div>RegisterPage</div>,
}));

vi.mock('./pages/ForgotPasswordPage', () => ({
  ForgotPasswordPage: () => <div>ForgotPasswordPage</div>,
}));

vi.mock('./pages/ResetPasswordPage', () => ({
  ResetPasswordPage: () => <div>ResetPasswordPage</div>,
}));

vi.mock('./pages/VerifyEmailPage', () => ({
  VerifyEmailPage: () => <div>VerifyEmailPage</div>,
}));

describe('AuthRoutes', () => {
  it('should render LoginPage for /login route', () => {
    render(
      <MemoryRouter initialEntries={['/login']}>
        <AuthRoutes />
      </MemoryRouter>,
    );
    expect(screen.getByText('LoginPage')).toBeInTheDocument();
  });

  it('should render RegisterPage for /register route', () => {
    render(
      <MemoryRouter initialEntries={['/register']}>
        <AuthRoutes />
      </MemoryRouter>,
    );
    expect(screen.getByText('RegisterPage')).toBeInTheDocument();
  });

  it('should render ForgotPasswordPage for /forgot-password route', () => {
    render(
      <MemoryRouter initialEntries={['/forgot-password']}>
        <AuthRoutes />
      </MemoryRouter>,
    );
    expect(screen.getByText('ForgotPasswordPage')).toBeInTheDocument();
  });

  it('should render ResetPasswordPage for /reset-password route', () => {
    render(
      <MemoryRouter initialEntries={['/reset-password']}>
        <AuthRoutes />
      </MemoryRouter>,
    );
    expect(screen.getByText('ResetPasswordPage')).toBeInTheDocument();
  });

  it('should render VerifyEmailPage for /verify-email route', () => {
    render(
      <MemoryRouter initialEntries={['/verify-email']}>
        <AuthRoutes />
      </MemoryRouter>,
    );
    expect(screen.getByText('VerifyEmailPage')).toBeInTheDocument();
  });
});
