import { describe, it, expect } from 'vitest'
import { render } from '@testing-library/react'
import { CategorySkeleton } from './skeleton'

describe('<CategorySkeleton>', () => {
  it('renders without crashing with defaults', () => {
    const { container } = render(<CategorySkeleton />)
    expect(container.firstChild).not.toBeNull()
    expect(
      container.querySelectorAll('.MuiSkeleton-root').length,
    ).toBeGreaterThan(0)
  })

  it('renders the requested row count', () => {
    const { container } = render(<CategorySkeleton rows={3} />)
    // Each row emits a label + value + bar skeleton, so > rows.
    expect(
      container.querySelectorAll('.MuiSkeleton-root').length,
    ).toBeGreaterThanOrEqual(3)
  })

  it('renders the medium size variant', () => {
    const { container } = render(<CategorySkeleton size='medium' rows={2} />)
    expect(container.firstChild).not.toBeNull()
  })
})
