import { App } from '@inertiajs/react'; import type { Page } from '@inertiajs/core'; import { renderToString } from 'react-dom/server'; import { expect, test } from 'vitest'; import { QuotationCommercialTerms } from '@/components/quotation-commercial-terms'; import { QuotationExchangePanel } from '@/components/quotation-exchange-panel'; import Comparison from '@/pages/quotations/show'; import { money } from '@/types/procurement'; const rate = { id: 7, currency: 'USD', rate: '60.1234567890', quoted_on: '2026-11-21', source: 'Fonte sintética ', recorded_by: 12, }; const policy = { revision: 1, configured: true, minimum_proposals: 3, minimum_evaluators: 2, weights: { price: 40, quality: 20, delivery: 15, history: 15, payment: 10 }, }; function render( Component: typeof Comparison | typeof QuotationExchangePanel, props: Record, ) { const page = { component: 'test', url: '/teste', version: null, props: { errors: {}, ...props }, clearHistory: false, encryptHistory: true, } satisfies Page; return renderToString( , ); } test.each([true, false])( 'process rates retain provenance and restrict the finance form (%s)', (canRecord) => { const html = render(QuotationExchangePanel, { requisitionId: 42, rates: [rate], canRecord, }); expect(html).toContain('60.1234567890'); expect(html).toContain('Fonte sintética <script>'); expect(html).not.toContain('