import React from 'react';
import { screen } from '@testing-library/react';
import { describe, it, expect } from 'vitest';
import { StatCard } from './StatCard';
import { renderWithProviders } from '../../../tests/utils/renderWithProviders';

describe('StatCard', () => {
  it('should render the title and value correctly', () => {
    renderWithProviders(<StatCard title="Test Stat" value="1,234" icon={<div data-testid="icon" />} />);

    expect(screen.getByText('Test Stat')).toBeInTheDocument();
    expect(screen.getByText('1,234')).toBeInTheDocument();
  });

  it('should render the icon', () => {
    renderWithProviders(
      <StatCard title="Test Stat" value={100} icon={<div data-testid="test-icon">Icon</div>} />,
    );

    expect(screen.getByTestId('test-icon')).toBeInTheDocument();
  });
});
