import React from 'react' import { render, fireEvent } from '@testing-library/react-native' import ErrorState from './ErrorState' describe('ErrorState Component', () => { describe('Basic Rendering', () => { it('should render error message', () => { const { getByText } = render() expect(getByText('Something went wrong')).toBeTruthy() }) it('should render with default message when not provided', () => { const { getByText } = render() expect(getByText('An error occurred')).toBeTruthy() }) }) describe('Retry Functionality', () => { it('should render retry button when onRetry is provided', () => { const onRetry = jest.fn() const { getByText } = render() expect(getByText('Retry')).toBeTruthy() }) it('should not render retry button when onRetry is not provided', () => { const { queryByText } = render() expect(queryByText('Retry')).toBeNull() }) it('should call onRetry when retry button is pressed', () => { const onRetry = jest.fn() const { getByText } = render() fireEvent.press(getByText('Retry')) expect(onRetry).toHaveBeenCalledTimes(1) }) }) describe('Props', () => { it('should accept testID prop', () => { const { getByTestId } = render() expect(getByTestId('error-test')).toBeTruthy() }) }) })