/** * AdminDataTable Component Tests * * Tests for the AdminDataTable component that provides a consistent * container for high-density admin tables. */ import React from 'react'; import { render, screen } from '@testing-library/react'; import { AdminDataTable } from './AdminDataTable'; import { describe, it, expect } from 'vitest'; describe('AdminDataTable', () => { it('should render children content', () => { render(
Test Data
); expect(screen.getByText('Test Data')).toBeInTheDocument(); }); it('should render with maxHeight prop', () => { render(
Scrollable Content
); expect(screen.getByText('Scrollable Content')).toBeInTheDocument(); }); it('should render with string maxHeight prop', () => { render(
Scrollable Content
); expect(screen.getByText('Scrollable Content')).toBeInTheDocument(); }); it('should render without maxHeight prop', () => { render(
Content
); expect(screen.getByText('Content')).toBeInTheDocument(); }); it('should render multiple table rows', () => { render(
Row 1
Row 2
Row 3
); expect(screen.getByText('Row 1')).toBeInTheDocument(); expect(screen.getByText('Row 2')).toBeInTheDocument(); expect(screen.getByText('Row 3')).toBeInTheDocument(); }); it('should render with complex table structure', () => { render(
Header 1 Header 2
Data 1 Data 2
); expect(screen.getByText('Header 1')).toBeInTheDocument(); expect(screen.getByText('Header 2')).toBeInTheDocument(); expect(screen.getByText('Data 1')).toBeInTheDocument(); expect(screen.getByText('Data 2')).toBeInTheDocument(); }); it('should render with nested components', () => { const NestedComponent = () => (
Nested
); render(
); expect(screen.getByText('Nested')).toBeInTheDocument(); expect(screen.getByText('Action')).toBeInTheDocument(); }); });