@@ -0,0 +1,88 @@
|
||||
import { App } from '@inertiajs/react';
|
||||
import { renderToStaticMarkup } from 'react-dom/server';
|
||||
import { expect, test } from 'vitest';
|
||||
import Readiness from '../../resources/js/pages/supply/import-readiness';
|
||||
import ImportTariffSummary from '../../resources/js/components/import-tariff-summary';
|
||||
|
||||
test('import follow-up preserves incomplete checks actionable links and unknown dates without rendering financial operations', () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<App
|
||||
initialComponent={Readiness}
|
||||
initialPage={{
|
||||
component: 'supply/import-readiness',
|
||||
url: '/qa',
|
||||
version: null,
|
||||
clearHistory: false,
|
||||
encryptHistory: true,
|
||||
props: {
|
||||
errors: {},
|
||||
importRecord: { id: 1, version: 2, state: 'arrived' },
|
||||
order: { id: 1, number: 'QA' },
|
||||
expectedUsableOn: null,
|
||||
checkedAt: '2026-11-27',
|
||||
complete: false,
|
||||
alerts: [
|
||||
{
|
||||
key: 'missing',
|
||||
category: 'Documentos',
|
||||
text: '<script>Missing synthetic licence</script>',
|
||||
href: '/compras/importacoes/1/documentos',
|
||||
},
|
||||
],
|
||||
},
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
expect(html).toContain('Verificação incompleta');
|
||||
expect(html).toContain('Por indicar');
|
||||
expect(html).toContain(
|
||||
'<script>Missing synthetic licence</script>',
|
||||
);
|
||||
expect(html).toContain('/compras/importacoes/1/documentos');
|
||||
expect(html).not.toContain('<form');
|
||||
});
|
||||
|
||||
test('issued classification displays the frozen legal citation and obligations rather than the current catalogue', () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<ImportTariffSummary
|
||||
records={{
|
||||
1: {
|
||||
record_id: 1,
|
||||
version: 2,
|
||||
item: {
|
||||
description: 'Synthetic item',
|
||||
quantity: '1',
|
||||
unit: 'KG',
|
||||
},
|
||||
data: {
|
||||
proposed_code: '1234',
|
||||
confirmed_code: '1234',
|
||||
source_reference: 'Source',
|
||||
confirmation_source: 'Confirmed source',
|
||||
deviation: false,
|
||||
},
|
||||
confirmed_by: { name: 'Synthetic buyer' },
|
||||
reason: 'Synthetic decision',
|
||||
legal_rule: {
|
||||
version: 5,
|
||||
data: {
|
||||
official_reference: 'Preserved official edition',
|
||||
citation: 'Article QA',
|
||||
obligations: 'Preserved documentary conditions',
|
||||
document_types: ['licence'],
|
||||
},
|
||||
context: {
|
||||
date: '2026-11-27',
|
||||
origin_country: 'Synthetic A',
|
||||
sector: 'Synthetic sector',
|
||||
},
|
||||
},
|
||||
},
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
expect(html).toContain('Preserved official edition');
|
||||
expect(html).toContain('Article QA');
|
||||
expect(html).toContain('versão 5');
|
||||
expect(html).toContain('Preserved documentary conditions');
|
||||
});
|
||||
Reference in New Issue
Block a user