import { describe, expect, it } from 'vitest';
import { render, screen } from '@testing-library/react';
import { SimulationStatusBadge } from '@/components/SimulationStatusBadge';
import type { SimulationStatus } from '@/api/types';

const CASES: { status: SimulationStatus; label: string }[] = [
  { status: 'pending', label: 'Pending' },
  { status: 'in_progress', label: 'In progress' },
  { status: 'review_required', label: 'Review required' },
  { status: 'done', label: 'Done' },
];

describe('SimulationStatusBadge', () => {
  it.each(CASES)('renders $status with correct label and data attr', ({ status, label }) => {
    render(<SimulationStatusBadge status={status} />);
    const badge = screen.getByTestId('simulation-status-badge');
    expect(badge).toHaveAttribute('data-status', status);
    expect(badge.textContent).toBe(label);
  });

  it('applies cloud surface for pending (terminal-SOC semantic tokens)', () => {
    render(<SimulationStatusBadge status="pending" />);
    const badge = screen.getByTestId('simulation-status-badge');
    expect(badge.className).toContain('bg-cloud');
  });

  it('applies primary-soft surface for in_progress', () => {
    render(<SimulationStatusBadge status="in_progress" />);
    const badge = screen.getByTestId('simulation-status-badge');
    expect(badge.className).toContain('bg-primary-soft');
  });

  it('applies warn-soft surface for review_required (terminal-SOC semantic tokens)', () => {
    render(<SimulationStatusBadge status="review_required" />);
    const badge = screen.getByTestId('simulation-status-badge');
    expect(badge.className).toContain('bg-warn-soft');
  });

  it('applies success-soft surface for done (terminal-SOC semantic tokens)', () => {
    render(<SimulationStatusBadge status="done" />);
    const badge = screen.getByTestId('simulation-status-badge');
    expect(badge.className).toContain('bg-success-soft');
  });
});
