mars-v2-frontend/__tests__/components/CircularProgress.test.tsx
Yusuf Seyrek e651e9c797
feat: store and component mocks setup (#237)
* feat: store and component mocks setup

* feat: more examples
2023-05-30 11:16:13 +02:00

35 lines
965 B
TypeScript

import { render } from '@testing-library/react'
import { CircularProgress } from 'components/CircularProgress'
import useStore from 'store'
describe('<CircularProgress />', () => {
afterAll(() => {
useStore.clearState()
})
it('should render', () => {
const { container } = render(<CircularProgress />)
expect(container).toBeInTheDocument()
})
it('should render `...` when animations disabled', () => {
useStore.setState({ enableAnimations: false })
const { getByText } = render(<CircularProgress />)
const threeDots = getByText('...')
expect(threeDots).toBeInTheDocument()
})
it('should render the component with animation classes when animations enabled', () => {
useStore.setState({ enableAnimations: true })
const { container } = render(<CircularProgress />)
const progressWithAnimations = container.querySelector('.animate-progress')
expect(progressWithAnimations).toBeInTheDocument()
})
})