Admin Page work - Still blank/broken

This commit is contained in:
Eric Gullickson
2025-11-06 16:29:11 -06:00
parent 858cf31d38
commit 5630979adf
38 changed files with 7373 additions and 924 deletions

View File

@@ -0,0 +1,59 @@
/**
* @ai-summary Tests for EmptyState component
*/
import React from 'react';
import { render, screen, fireEvent } from '@testing-library/react';
import { EmptyState } from '../../components/EmptyState';
describe('EmptyState', () => {
it('should render with title and description', () => {
const { container } = render(
<EmptyState
title="No Data"
description="Start by adding your first item"
/>
);
expect(container).toMatchSnapshot();
expect(screen.getByText('No Data')).toBeInTheDocument();
expect(screen.getByText('Start by adding your first item')).toBeInTheDocument();
});
it('should render with icon', () => {
const { container } = render(
<EmptyState
icon={<div data-testid="test-icon">Icon</div>}
title="Empty"
description="No items found"
/>
);
expect(container).toMatchSnapshot();
expect(screen.getByTestId('test-icon')).toBeInTheDocument();
});
it('should render action button when provided', () => {
const handleAction = jest.fn();
render(
<EmptyState
title="No Items"
description="Add your first item"
action={{ label: 'Add Item', onClick: handleAction }}
/>
);
const button = screen.getByText('Add Item');
expect(button).toBeInTheDocument();
fireEvent.click(button);
expect(handleAction).toHaveBeenCalledTimes(1);
});
it('should not render action button when not provided', () => {
render(<EmptyState title="Empty" description="No data" />);
expect(screen.queryByRole('button')).not.toBeInTheDocument();
});
});