import React from 'react';
import { render, screen } from '@testing-library/react';
import Card from './Card';

describe('Card', () => {
  it('renders children inside card body', () => {
    render(
      <Card>
        <span>Card content</span>
      </Card>
    );

    expect(screen.getByText('Card content')).toBeInTheDocument();
    expect(screen.getByText('Card content').closest('.card')).toHaveClass('card-body');
  });

  it('renders empty card when no children given', () => {
    const { container } = render(<Card />);
    expect(container.querySelector('.card.card-body')).toBeInTheDocument();
    expect(container.querySelector('.card.card-body')?.childElementCount).toBe(0);
  });
});
