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('