import { App } from '@inertiajs/react';
import { renderToStaticMarkup } from 'react-dom/server';
import { expect, test } from 'vitest';
import ImportEstimate from '@/pages/supply/import-estimate';
function renderPlan(linked = false) {
const page = { data: [], prev_page_url: null, next_page_url: null };
const source = {
id: 4,
version: 2,
snapshot: {
item: { description: 'Synthetic valued item' },
legal_rule: {
data: { official_reference: 'Preserved official source' },
},
result: {
lines: [
{
key: 'duty-line',
kind: 'duty',
label: 'Synthetic documented duty',
method: 'ad_valorem',
amount_minor: 750,
},
],
},
},
};
return renderToStaticMarkup(
,
);
}
test('native import preparation offers legal source reuse and additional parcels without silently selecting a value', () => {
const html = renderPlan();
expect(html).toContain('Reutilizar uma imposição calculada');
expect(html).toContain('Synthetic valued item');
expect(html).toContain('7.50 MZN');
expect(html).toContain('Acrescentar parcela desta família');
expect(html).not.toContain('O total conserva a fonte seleccionada');
});
test('a preserved legal amount retains explicit budget tax treatment and a deliberate manual-detach action', () => {
const html = renderPlan(true);
expect(html).toContain('O total conserva a fonte seleccionada');
expect(html).toContain('divisão entre base e imposto');
expect(html).toContain('retirar ligação e conservar os valores');
expect(html.match(/