/**
 * EmptyState Component Tests
 */

import { render, screen } from '@testing-library/react';
import { EmptyState } from '@/components/dashboard/EmptyState';

// Mock next-intl navigation
jest.mock('@/lib/i18n/routing', () => ({
  Link: ({ children, href }: { children: React.ReactNode; href: string }) => (
    <a href={href}>{children}</a>
  ),
}));

describe('EmptyState', () => {
  it('displays welcome message with user name', () => {
    render(<EmptyState userName="John" />);

    expect(screen.getByText(/Welcome to Syndarix, John!/)).toBeInTheDocument();
  });

  it('displays default greeting when no userName provided', () => {
    render(<EmptyState />);

    expect(screen.getByText(/Welcome to Syndarix, there!/)).toBeInTheDocument();
  });

  it('displays description text', () => {
    render(<EmptyState />);

    expect(screen.getByText(/Get started by creating your first project/)).toBeInTheDocument();
  });

  it('displays Create Your First Project button', () => {
    render(<EmptyState />);

    const createButton = screen.getByRole('link', { name: /Create Your First Project/i });
    expect(createButton).toBeInTheDocument();
    expect(createButton).toHaveAttribute('href', '/projects/new');
  });

  it('displays quick action links', () => {
    render(<EmptyState />);

    const agentsLink = screen.getByRole('link', { name: /Set up AI agent types/i });
    expect(agentsLink).toHaveAttribute('href', '/agents');

    const settingsLink = screen.getByRole('link', { name: /Configure your account/i });
    expect(settingsLink).toHaveAttribute('href', '/settings');
  });

  it('applies custom className', () => {
    const { container } = render(<EmptyState className="custom-class" />);

    expect(container.firstChild).toHaveClass('custom-class');
  });
});
