wwf
2025-05-20 938c3e5a587ce950a94964ea509b9e7f8834dfae
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import React from 'react'
import { render } from '@testing-library/react'
import '@testing-library/jest-dom'
import Loading from './index'
 
describe('Loading Component', () => {
  it('renders correctly with default props', () => {
    const { container } = render(<Loading />)
    expect(container.firstChild).toHaveClass('flex w-full items-center justify-center')
    expect(container.firstChild).not.toHaveClass('h-full')
  })
 
  it('renders correctly with area type', () => {
    const { container } = render(<Loading type="area" />)
    expect(container.firstChild).not.toHaveClass('h-full')
  })
 
  it('renders correctly with app type', () => {
    const { container } = render(<Loading type='app' />)
    expect(container.firstChild).toHaveClass('h-full')
  })
 
  it('contains SVG with spin-animation class', () => {
    const { container } = render(<Loading />)
 
    const svgElement = container.querySelector('svg')
    expect(svgElement).toHaveClass('spin-animation')
  })
})