import { describe, expect, it } from 'bun:test';
import { renderToStaticMarkup } from 'react-dom/server';
import { GhostCard } from './GhostCard';
import type { GhostNote } from '../../../types/research';

const sampleGhost: GhostNote = {
  id: 'ghost-1',
  workspaceId: 'workspace-1',
  ghostClass: 'candidate_thesis',
  headline: 'Possible earnings power inflection',
  body: 'Observed: margin commentary improved. Inference: earnings power may be understated.',
  tone: 'tentative',
  confidence: 0.88,
  visibilityState: 'visible',
  state: 'visible',
  supportingNoteIds: ['note-1', 'note-2'],
  contradictingNoteIds: ['note-3'],
  sourceIds: ['source-1'],
  evidenceThresholdMet: true,
  createdAt: '2026-04-09T10:00:00Z',
  updatedAt: '2026-04-09T10:00:00Z',
};

describe('GhostCard', () => {
  it('renders ghost summary and evidence counts', () => {
    const html = renderToStaticMarkup(
      <GhostCard ghost={sampleGhost} density="comfortable" />,
    );

    expect(html).toContain('Possible earnings power inflection');
    expect(html).toContain('Candidate Thesis');
    expect(html).toContain('2 supporting');
    expect(html).toContain('1 contradicting');
  });
});
