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

import { TreeCard } from './TreeCard'

vi.mock('antd', () => ({
  Card: ({
    children,
    className,
  }: {
    children?: React.ReactNode
    className?: string
  }) => (
    <div data-testid="card" data-class={className}>
      {children}
    </div>
  ),
}))

describe('TreeCard', () => {
  it('renders children content', () => {
    render(
      <TreeCard>
        <div>tree content</div>
      </TreeCard>,
    )

    expect(screen.getByText('tree content')).toBeInTheDocument()
  })

  it('applies custom className', () => {
    render(
      <TreeCard className="custom-tree-class">
        <div>content</div>
      </TreeCard>,
    )

    expect(screen.getByTestId('card')).toHaveAttribute('data-class', expect.stringContaining('custom-tree-class'))
  })
})
