/**
* @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(
);
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(
Icon}
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(
);
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();
expect(screen.queryByRole('button')).not.toBeInTheDocument();
});
});