import { describe, expect, it } from 'vitest' import { render, screen } from '@testing-library/react' import EmptyState from './EmptyState' describe('EmptyState', () => { const defaultProps = { primaryText: 'No Data Available', } it('renders with primary text', () => { render() const component = screen.getByTestId('empty-state-component') expect(component).toBeInTheDocument() const primaryText = screen.getByTestId('empty-state-primary-text') expect(primaryText).toBeInTheDocument() expect(primaryText).toHaveTextContent('No Data Available') }) it('renders with secondary text when provided', () => { const secondaryText = 'Please try again later' render() const secondaryTextElement = screen.getByTestId( 'empty-state-secondary-text', ) expect(secondaryTextElement).toBeInTheDocument() expect(secondaryTextElement).toHaveTextContent(secondaryText) }) it('renders with icon when provided', () => { render() const icon = screen.getByTestId('icon-info') expect(icon).toBeInTheDocument() }) it('renders with button when buttonProps are provided', () => { const buttonProps = { children: 'Refresh', onClick: () => {}, } render() const button = screen.getByRole('button', { name: 'Refresh' }) expect(button).toBeInTheDocument() }) it('does not render secondary text when not provided', () => { render() const secondaryText = screen.queryByTestId('empty-state-secondary-text') expect(secondaryText).not.toBeInTheDocument() }) it('does not render icon when not provided', () => { render() const icon = screen.queryByTestId('icon-info') expect(icon).not.toBeInTheDocument() }) it('does not render button when buttonProps are not provided', () => { render() const button = screen.queryByRole('button') expect(button).not.toBeInTheDocument() }) })