Files
gridpilot.gg/apps/website/components/admin/AdminDashboardLayout.test.tsx
Marc Mintel fb1221701d
Some checks failed
Contract Testing / contract-tests (push) Failing after 6m7s
Contract Testing / contract-snapshot (push) Failing after 4m46s
add tests
2026-01-22 11:52:42 +01:00

82 lines
2.3 KiB
TypeScript

/**
* AdminDashboardLayout Component Tests
*
* Tests for the AdminDashboardLayout component that provides a consistent
* container layout for admin pages.
*/
import React from 'react';
import { render, screen } from '@testing-library/react';
import { AdminDashboardLayout } from './AdminDashboardLayout';
import { describe, it, expect } from 'vitest';
describe('AdminDashboardLayout', () => {
it('should render children content', () => {
render(
<AdminDashboardLayout>
<div data-testid="content">Dashboard Content</div>
</AdminDashboardLayout>
);
expect(screen.getByTestId('content')).toBeTruthy();
expect(screen.getByText('Dashboard Content')).toBeTruthy();
});
it('should render multiple children', () => {
render(
<AdminDashboardLayout>
<div>Section 1</div>
<div>Section 2</div>
<div>Section 3</div>
</AdminDashboardLayout>
);
expect(screen.getByText('Section 1')).toBeTruthy();
expect(screen.getByText('Section 2')).toBeTruthy();
expect(screen.getByText('Section 3')).toBeTruthy();
});
it('should render with complex nested components', () => {
const ComplexComponent = () => (
<div>
<h2>Complex Section</h2>
<p>With multiple elements</p>
<button>Action</button>
</div>
);
render(
<AdminDashboardLayout>
<ComplexComponent />
</AdminDashboardLayout>
);
expect(screen.getByText('Complex Section')).toBeTruthy();
expect(screen.getByText('With multiple elements')).toBeTruthy();
expect(screen.getByText('Action')).toBeTruthy();
});
it('should render empty layout gracefully', () => {
render(<AdminDashboardLayout />);
// Should render without errors even with no children
expect(document.body).toBeInTheDocument();
});
it('should render with mixed content types', () => {
render(
<AdminDashboardLayout>
<div>Text content</div>
<span>Span content</span>
<button>Button</button>
<input type="text" placeholder="Input" />
</AdminDashboardLayout>
);
expect(screen.getByText('Text content')).toBeInTheDocument();
expect(screen.getByText('Span content')).toBeInTheDocument();
expect(screen.getByText('Button')).toBeInTheDocument();
expect(screen.getByPlaceholderText('Input')).toBeInTheDocument();
});
});