42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import React from 'react'
|
|
import { render } from '@testing-library/react-native'
|
|
import LoadingState from './LoadingState'
|
|
|
|
describe('LoadingState Component', () => {
|
|
describe('Basic Rendering', () => {
|
|
it('should render ActivityIndicator', () => {
|
|
const { UNSAFE_root } = render(<LoadingState />)
|
|
expect(UNSAFE_root).toBeTruthy()
|
|
})
|
|
|
|
it('should render with optional message', () => {
|
|
const { getByText } = render(<LoadingState message="Loading..." />)
|
|
expect(getByText('Loading...')).toBeTruthy()
|
|
})
|
|
|
|
it('should render without message when not provided', () => {
|
|
const { queryByText } = render(<LoadingState />)
|
|
expect(queryByText(/./)).toBeNull()
|
|
})
|
|
})
|
|
|
|
describe('Theme Support', () => {
|
|
it('should use light color by default', () => {
|
|
const { UNSAFE_root } = render(<LoadingState />)
|
|
expect(UNSAFE_root).toBeTruthy()
|
|
})
|
|
|
|
it('should accept custom color', () => {
|
|
const { UNSAFE_root } = render(<LoadingState color="#FF0000" />)
|
|
expect(UNSAFE_root).toBeTruthy()
|
|
})
|
|
})
|
|
|
|
describe('Props', () => {
|
|
it('should accept testID prop', () => {
|
|
const { getByTestId } = render(<LoadingState testID="loading-test" />)
|
|
expect(getByTestId('loading-test')).toBeTruthy()
|
|
})
|
|
})
|
|
})
|