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

import { TableCard } from './TableCard'

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

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

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

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

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