feat(sources): replace WatcherGuru with CNBC Business

Add the CNBC Business RSS source, switch supported-source wiring and reporting, and migrate existing WatcherGuru rows to disabled historical status without rewriting references.

Refs #23

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 17:17:15 +01:00
parent 1ff78a7b31
commit 64a7124889
18 changed files with 511 additions and 26 deletions

View File

@ -0,0 +1,33 @@
import { cleanup, render, screen, within } from '@testing-library/react'
import { afterEach, expect, it } from 'vitest'
import { GenerationDetails } from '../src/components/GenerationDetails'
import type { GenerationOutcome } from '../src/api/summaries'
afterEach(cleanup)
function outcome(sourceType: string): GenerationOutcome {
return {
id: 'generation-23', status: 'partial', language: 'fr', ranking_mode: 'title',
total_candidates: 0, content_fallbacks: 0, laya_selected: 0, selected: 0, global_limit: 50,
source_stats: [{ source_id: 'source-23', source_type: sourceType, status: 'failed', candidates: 0, laya_selected: 0, selected: 0, article_limit: 20, content_fallbacks: 0, failure_code: 'source_unavailable' }],
}
}
it('nomme CNBC Business dans le diagnostic agrégé sans exposer de détails de récupération', () => {
const result = outcome('cnbc_business')
render(<GenerationDetails outcome={result} />)
expect(screen.getByText('Cette synthèse a été générée sans CNBC Business, indisponible lors du traitement.')).toBeInTheDocument()
const row = screen.getByText('CNBC Business').closest('tr')!
expect(within(row).getByText('Indisponible')).toBeInTheDocument()
expect(screen.queryByText('source_unavailable')).not.toBeInTheDocument()
expect(screen.queryByRole('link')).not.toBeInTheDocument()
})
it.each(['watcherguru', 'Watcher.Guru', 'Watcher Guru'])('garde le bilan historique %s sans réécrire son identité', sourceType => {
const result = outcome(sourceType)
const before = JSON.stringify(result)
render(<GenerationDetails outcome={result} />)
expect(screen.getByText(sourceType, { exact: true })).toBeInTheDocument()
expect(screen.queryByText(/CNBC Business/)).not.toBeInTheDocument()
expect(JSON.stringify(result)).toBe(before)
})