// Wave 6 — FightCard honesty locks (source-grep, same discipline as
// colorContract.test.js). The card must: self-hide on a non-two-fighter bout,
// render tale-of-the-tape as MONO data, label the verdict a MODEL read, and
// show method/round/KO as honest "data-limited" — never a fabricated grade.

const fs = require('fs');
const path = require('path');
const WEB = path.join(__dirname, '..', '..', 'web', 'src');
const read = (rel) => fs.readFileSync(path.join(WEB, rel), 'utf8');

describe('FightCard.tsx — honest v1 tale-of-the-tape', () => {
  const src = read('components/vyndr/FightCard.tsx');

  it('self-hides (returns null) when there arent two named fighters', () => {
    expect(src).toMatch(/fighters\.length < 2/);
    expect(src).toMatch(/return null/);
  });

  it('data rows are MONO, and no glitch CLASS is applied to any element (data never glitches)', () => {
    expect(src).toContain('className="mono"');
    // No glitch animation class on any element (comments about "never glitches" are fine).
    expect(src).not.toMatch(/className=["'`][^"'`]*glitch/);
  });

  it('method / round / KO cells are shown as honest "data-limited", not fabricated', () => {
    expect(src).toMatch(/dataLimited/);
    expect(src).toContain('data-limited');
    expect(src).toMatch(/METHOD/);
  });

  it('the verdict is explicitly labeled a MODEL read, not a settled grade', () => {
    expect(src).toContain('MODEL READ');
    expect(src).toContain('INSUFFICIENT READ');
  });

  it('uses a monogram (no fighter photo / likeness)', () => {
    expect(src).toContain('Monogram');
    expect(src).not.toMatch(/headshot|espncdn.*headshots|<img/i);
  });

  it('renders the archetype chip through the shared ArchetypeBadge with sport="mma"', () => {
    expect(src).toContain('ArchetypeBadge');
    expect(src).toMatch(/sport="mma"/);
  });

  it('absent odds render as a dash, never a fabricated number', () => {
    expect(src).toMatch(/const DASH = '—'/);
    expect(src).toMatch(/Number\.isFinite/);
  });
});
