import { App } from '@inertiajs/react'; import type { Page } from '@inertiajs/core'; import { renderToString } from 'react-dom/server'; import { expect, test } from 'vitest'; import { AiPlanSettings } from '@/components/ai-plan-settings'; import { AiPreparationPreview } from '@/components/ai-preparation-preview'; import type { AiPreparation } from '@/components/ai-preparation-preview'; const page = { component: 'company/parameters', url: '/administracao/parametrizacao', version: 'ai-plan', props: { errors: {} }, clearHistory: false, encryptHistory: true, } satisfies Page; test.each([true, false])( 'AI preparation settings clearly save a plan rather than activate a provider (%s)', (ready) => { function Screen() { return ( ); } const html = renderToString( , ); expect(html.includes(' { const data: AiPreparation = { status, external_execution_enabled: false, usage_checked: false, policy_revision: 2, provider: 'openai', model: 'gpt-5.6-terra', max_input_bytes: 4500, max_output_tokens: 1000, input_bytes: 123, facts: status === 'draft' ? [ { id: 'request', text: 'Pedido em aprovação.', source: { href: '#report-request', label: 'Identificação do pedido', pointer: 'requisition.status', }, }, ] : [], }; const html = renderToString(); if (status === 'not_configured') expect(html).toBe(''); else { expect(html).toContain('O plano não autoriza execução externa'); expect(html).not.toContain('