import { canRenderProductionEvidence, Metric } from '@/components/marketing/Evidence';
import { render, screen } from '@testing-library/react';
import { describe, expect, it } from 'vitest';

describe('evidence governance', () => {
  it('allows only approved evidence in production mode', () => {
    expect(canRenderProductionEvidence('approved')).toBe(true);
    expect(canRenderProductionEvidence('pending-review')).toBe(false);
    expect(canRenderProductionEvidence('research-only')).toBe(false);
    expect(canRenderProductionEvidence('prohibited')).toBe(false);
  });

  it('suppresses research-only metrics in production mode', () => {
    const { container } = render(
      <Metric
        production
        statusLabel="Research only"
        content={{ value: '24', label: 'Fixture', status: 'research-only' }}
      />,
    );
    expect(container).toBeEmptyDOMElement();
  });

  it('renders approved evidence with its source reference', () => {
    render(
      <Metric
        production
        statusLabel="Approved"
        content={{
          value: '1',
          label: 'Approved fixture',
          status: 'approved',
          sourceReference: 'SRC-001',
        }}
      />,
    );
    expect(screen.getByText('SRC-001')).toBeVisible();
  });
});
