/**
 * Tests for DefaultLayout component
 */
import { render, screen } from '@testing-library/react';
import { DefaultLayout } from '../DefaultLayout';

describe('DefaultLayout', () => {
  it('renders sections correctly', () => {
    const sections = [<div key="1">Section 1</div>, <div key="2">Section 2</div>];
    render(<DefaultLayout sections={sections} />);
    expect(screen.getByText('Section 1')).toBeInTheDocument();
    expect(screen.getByText('Section 2')).toBeInTheDocument();
  });

  it('renders hero when provided', () => {
    const hero = <div>Hero Content</div>;
    render(<DefaultLayout hero={hero} sections={[]} />);
    expect(screen.getByText('Hero Content')).toBeInTheDocument();
  });

  it('renders sidebar when provided', () => {
    const sidebar = <div>Sidebar Content</div>;
    render(<DefaultLayout sections={[]} sidebar={sidebar} />);
    expect(screen.getByText('Sidebar Content')).toBeInTheDocument();
  });

  it('renders all sections together', () => {
    const hero = <div>Hero</div>;
    const sections = [<div key="1">Section</div>];
    const sidebar = <div>Sidebar</div>;
    
    render(
      <DefaultLayout
        hero={hero}
        sections={sections}
        sidebar={sidebar}
      />
    );
    
    expect(screen.getByText('Hero')).toBeInTheDocument();
    expect(screen.getByText('Section')).toBeInTheDocument();
    expect(screen.getByText('Sidebar')).toBeInTheDocument();
  });

  it('handles empty sections array', () => {
    render(<DefaultLayout sections={[]} />);
    expect(screen.queryByText('Section')).not.toBeInTheDocument();
  });
});

