import { renderToStaticMarkup } from 'react-dom/server' import { describe, expect, it } from 'vitest' import QuoteCard from './QuoteCard' // Test-only wording: nothing here is served by the app. describe('QuoteCard (#1108)', () => { it('shows the real thumbnail, play label, place/date, highlighted quote and speaker row', () => { const html = renderToStaticMarkup( , ) expect(html).toContain('https://i.ytimg.com/vi/7VghnjHd_1w/hqdefault.jpg') expect(html).toContain('alt="Recording of the Testville, MO meeting"') expect(html).toContain('Hear it at 4:07') expect(html).toContain('Testville, MO · May 7, 2026') expect(html).toMatch(/]*>data center<\/mark>/) expect(html).toContain('>TP<') expect(html).toContain('Test P.') expect(html).toContain('Spoke against') expect(html).toContain('Resident · On: Rezoning for a site') expect(html).not.toContain('In the meeting') }) it('has no image without a video, and no speaker row for a meeting passage', () => { const html = renderToStaticMarkup() expect(html).not.toContain(' { const html = renderToStaticMarkup() expect(html).not.toContain(' { const html = renderToStaticMarkup() expect(html).not.toContain('qcard-avatar') expect(html).toContain('Spoke for') }) it('shows the AI summary, labelled, and the meeting analysis link when on record (#1124)', () => { const html = renderToStaticMarkup( , ) expect(html).toContain('AI summary') // React-escaped: markup in the record is shown as text, never rendered. expect(html).toContain('The board <b>discussed</b> a pause.') expect(html).toContain('class="qcard-summary-text"') expect(html).toContain('href="/meetings/12?state=GA"') expect(html).toContain('Open the meeting analysis →') expect(html).toContain('In the meeting · Council') }) it('shows no summary block and no link without them (#1124)', () => { const html = renderToStaticMarkup() expect(html).not.toContain('AI summary') expect(html).not.toContain('qcard-summary') expect(html).not.toContain('Open the meeting analysis') }) it('names an attributed speaker instead of "In the meeting" (#1124)', () => { const html = renderToStaticMarkup() expect(html).toContain('Test P.') expect(html).toContain('Resident') expect(html).not.toContain('In the meeting') }) }) describe('QuoteCard inline video (#1277, the story maps hover card)', () => { it('autoplay embeds the recording muted at the moment, with no play button', () => { const html = renderToStaticMarkup() expect(html).toContain(' { const html = renderToStaticMarkup() expect(html).not.toContain(' { const html = renderToStaticMarkup() expect(html).not.toContain(' { const html = renderToStaticMarkup() expect(html).not.toContain('AI summary') }) it('compact is person-first: quote, then who said it, then meeting · place · date; no filler (#1277)', () => { const html = renderToStaticMarkup( , ) const q = html.indexOf('the quoted words') const who = html.indexOf('Test P.') const at = html.indexOf('City Council · Testville, AZ · May 7, 2026') expect(q).toBeGreaterThan(-1) expect(who).toBeGreaterThan(q) expect(at).toBeGreaterThan(who) expect(html).not.toContain('In the meeting') const bare = renderToStaticMarkup() expect(bare).not.toContain('In the meeting') expect(bare).not.toContain('qcard-speaker') }) })