import { App } from '@inertiajs/react'; import { renderToStaticMarkup } from 'react-dom/server'; import { expect, test } from 'vitest'; import Evaluation from '@/pages/suppliers/evaluation'; test.each([false, true])( 'report preserves the decision and identifies only the recorded reviewer (%s)', (knownName) => { const html = renderToStaticMarkup( ' } : {}, history: { data: [], total: 0, prev_page_url: null, next_page_url: null, }, generatedAt: '2026-11-28T12:00:00Z', improvements: { ready: false, records: [] }, responses: { ready: false, records: [] }, evaluation: { id: 1, supplier_id: 2, revision: 1, version: 3, status: 'approved', previous_id: null, created_by: 4, contributors: [4], supplier_snapshot: { id: 2, name: 'Fornecedor QA', nuit: '123456789', }, payload: { title: 'Avaliação QA', nature: 'goods', scope: 'Âmbito sintético.', period_start: '2026-11-28', period_end: '2026-11-28', order_ids: [], criteria: [], conclusion: 'Conclusão preservada.', critical_occurrences: '', critical_evidence: '', }, review_reason: 'Fundamento preservado.', reviewed_by: 7, reviewed_at: '2026-11-28T12:00:00Z', }, }, }} />, ); expect(html).toContain('Última decisão documentada'); expect(html).toContain('href="#evaluation-last-review"'); expect(html).toContain('id="evaluation-last-review" tabindex="-1"'); expect(html).not.toContain('href="#evaluation-history"'); expect(html).toContain('Fundamento preservado.'); expect(html).toContain(knownName ? 'Revisor <QA>' : '#7'); expect(html).not.toContain('Revisor '); expect(html).not.toContain('2026-11-28T12:00:00Z'); expect(html).not.toContain('([\s\S]*?)<\/section><\/div>/, )?.[1]; expect(decisionGroup).toContain('Fundamento preservado.'); expect(decisionGroup).toContain( knownName ? 'Revisor <QA>' : '#7', ); expect(decisionGroup).toContain( new Date('2026-11-28T12:00:00Z').toLocaleString('pt-MZ'), ); }, );