@@ -0,0 +1,94 @@
|
||||
import { App } from '@inertiajs/react';
|
||||
import { renderToStaticMarkup } from 'react-dom/server';
|
||||
import { expect, test } from 'vitest';
|
||||
import { CompanyDetailsSettings } from '@/components/company-details-settings';
|
||||
|
||||
function render(ready: boolean) {
|
||||
return renderToStaticMarkup(
|
||||
<App
|
||||
initialComponent={CompanyDetailsSettings}
|
||||
initialPage={{
|
||||
component: 'company/parameters',
|
||||
url: '/administracao/parametrizacao',
|
||||
version: null,
|
||||
clearHistory: false,
|
||||
encryptHistory: true,
|
||||
props: {
|
||||
ready,
|
||||
version: 3,
|
||||
errors: {},
|
||||
details: {
|
||||
legal_name: 'Empresa sintética <QA>',
|
||||
nuit: '001234567',
|
||||
bank_accounts: [
|
||||
{
|
||||
id: 'a',
|
||||
bank: 'Banco sintético A',
|
||||
account_number: '00001234',
|
||||
currency: 'MZN',
|
||||
},
|
||||
{
|
||||
id: 'b',
|
||||
bank: 'Banco sintético B',
|
||||
account_number: '00005678',
|
||||
currency: 'USD',
|
||||
},
|
||||
],
|
||||
establishments: [
|
||||
{
|
||||
id: 'c',
|
||||
kind: 'headquarters',
|
||||
name: 'Sede sintética',
|
||||
address: 'Endereço A',
|
||||
},
|
||||
{
|
||||
id: 'd',
|
||||
kind: 'branch',
|
||||
name: 'Sucursal sintética',
|
||||
address: 'Endereço B',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
}
|
||||
|
||||
test('company form presents distinct accounts and establishments with Portuguese labels and preserved identifiers', () => {
|
||||
const html = render(true);
|
||||
for (const text of [
|
||||
'Denominação social',
|
||||
'NUEL',
|
||||
'NUIT',
|
||||
'Representante legal',
|
||||
'Balcão',
|
||||
'Número de conta',
|
||||
'NIB',
|
||||
'IBAN',
|
||||
'NUIB',
|
||||
'Titular da conta',
|
||||
'00001234',
|
||||
'00005678',
|
||||
'MZN',
|
||||
'USD',
|
||||
'Endereço A',
|
||||
'Endereço B',
|
||||
'Adicionar estabelecimento',
|
||||
'Adicionar conta bancária',
|
||||
]) {
|
||||
expect(html).toContain(text);
|
||||
}
|
||||
expect(html).toContain('Empresa sintética <QA>');
|
||||
expect(html).toContain('id="bank-a-account_number"');
|
||||
expect(html).toContain('id="bank-b-account_number"');
|
||||
expect(html).toContain('id="establishment-c-name"');
|
||||
expect(html).toContain('id="establishment-d-name"');
|
||||
});
|
||||
|
||||
test('uninstalled schema explains availability without presenting a form that cannot save', () => {
|
||||
const html = render(false);
|
||||
expect(html).toContain('Instalação dos campos da empresa pendente');
|
||||
expect(html).not.toContain('<form');
|
||||
expect(html).not.toContain('00001234');
|
||||
});
|
||||
Reference in New Issue
Block a user