// src/components/StatCard.test.tsx
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';
import '@testing-library/jest-dom';

describe('StatCard', () => {
  it('renders title and value correctly', () => {
    renderWithProviders(
      <StatCard
        title="Total Users"
        value="1,234"
        icon={<div data-testid="mock-icon">Icon</div>}
      />,
    );

    expect(screen.getByText('Total Users')).toBeInTheDocument();
    expect(screen.getByText('1,234')).toBeInTheDocument();
  });

  it('renders the icon', () => {
    renderWithProviders(
      <StatCard
        title="Total Users"
        value="1,234"
        icon={<div data-testid="mock-icon">Icon</div>}
      />,
    );

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