43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
import { App } from '@inertiajs/react';
|
|
import type { Page } from '@inertiajs/core';
|
|
import { renderToString } from 'react-dom/server';
|
|
import { expect, test } from 'vitest';
|
|
import { IntelligenceSettings } from '@/components/intelligence-settings';
|
|
|
|
test.each([true, false])(
|
|
'intelligence settings expose local domain choices only when installed (%s)',
|
|
(ready) => {
|
|
const page = {
|
|
component: 'company/parameters',
|
|
url: '/administracao/parametrizacao',
|
|
version: 'policy',
|
|
props: { errors: {} },
|
|
clearHistory: false,
|
|
encryptHistory: true,
|
|
} satisfies Page;
|
|
function Screen() {
|
|
return (
|
|
<IntelligenceSettings
|
|
ready={ready}
|
|
version={2}
|
|
policy={{
|
|
revision: 1,
|
|
configured: true,
|
|
procurement_brief: false,
|
|
people_brief: true,
|
|
}}
|
|
/>
|
|
);
|
|
}
|
|
const html = renderToString(
|
|
<App initialPage={page} initialComponent={Screen} />,
|
|
);
|
|
expect(html).toContain('externo de documentos');
|
|
expect(html.includes('<form')).toBe(ready);
|
|
if (ready) {
|
|
expect(html).toContain('Síntese com fontes em Compras');
|
|
expect(html).toContain('Síntese com fontes em Pessoas');
|
|
} else expect(html).toContain('Instalação da configuração');
|
|
},
|
|
);
|