import { render, screen, fireEvent } from '@testing-library/react';
import App from './App';

describe('App', () => {
  it('renders all 3 tabs in nav', () => {
    render(<App />);
    expect(screen.getByRole('button', { name: /dashboard/i })).toBeInTheDocument();
    expect(screen.getByRole('button', { name: /forms/i })).toBeInTheDocument();
    expect(screen.getByRole('button', { name: /settings/i })).toBeInTheDocument();
  });

  it('dashboard tab is active by default and shows stat cards', () => {
    render(<App />);
    expect(screen.getByText('Forms Generated')).toBeInTheDocument();
    expect(screen.getByText('Documents Indexed')).toBeInTheDocument();
    expect(screen.getByText('Plan')).toBeInTheDocument();
    expect(screen.getByText('Free')).toBeInTheDocument();
  });

  it('clicking Forms tab shows "Form builder coming soon."', () => {
    render(<App />);
    fireEvent.click(screen.getByRole('button', { name: /forms/i }));
    expect(screen.getByText('Form builder coming soon.')).toBeInTheDocument();
  });

  it('clicking Settings tab shows "Settings panel coming soon."', () => {
    render(<App />);
    fireEvent.click(screen.getByRole('button', { name: /settings/i }));
    expect(screen.getByText('Settings panel coming soon.')).toBeInTheDocument();
  });
});
