feat: consolidar desenvolvimentos do portal InvestMoz

This commit is contained in:
2026-11-03 23:32:32 +02:00
parent 1da273f1f3
commit 36c8cadb49
345 changed files with 110714 additions and 2799 deletions
@@ -27,7 +27,7 @@ function load(file, overrides = {}) {
);
return module.exports;
}
function render(payload) {
function render(payload, extra = {}) {
const empty = () => null;
const page = load('../../resources/js/pages/desk/request.tsx', {
'@inertiajs/react': {
@@ -39,12 +39,39 @@ function render(payload) {
'@/lib/desk-field-visibility': load(
'../../resources/js/lib/desk-field-visibility.ts',
),
'@/lib/desk-field-values': load(
'../../resources/js/lib/desk-field-values.ts',
),
'@/components/desk-typed-choice': load(
'../../resources/js/components/desk-typed-choice.tsx',
{
'@/lib/desk-field-values': load(
'../../resources/js/lib/desk-field-values.ts',
),
},
),
'@/components/dossier-prefill': { DossierPrefill: empty },
'@/components/desk-draft-recovery': {
__esModule: true,
default: empty,
},
'@/components/country-select': { __esModule: true, default: empty },
'@/components/desk-attachment-field': {
__esModule: true,
default: empty,
},
'@/components/investment-territory': { TerritoryFields: empty },
'@/components/desk-internal-operations': {
DocumentReview: empty,
RequestOperations: empty,
RequestOperations: ({ owner, reviewer, payments }) =>
createElement(
'section',
{
'data-test': 'manual-operations',
'data-writable': owner || reviewer ? 'yes' : 'no',
},
payments.map((payment) => payment.reference).join(', '),
),
},
'@/pages/investment/shared': {
Frame: ({ children }) => createElement('main', null, children),
@@ -54,7 +81,7 @@ function render(payload) {
},
}).default;
return renderToStaticMarkup(
page({
createElement(page, {
request: {
id: 'synthetic-request',
version: 1,
@@ -107,9 +134,28 @@ function render(payload) {
caseVersion: 1,
countries: [],
toolPrefill: null,
...extra,
}),
);
}
await test('manual payment history remains visible with operations disabled and legacy draft props still render', () => {
const readonly = render(
{},
{
operationsEditable: false,
payments: [{ reference: 'SYNTHETIC historical payment' }],
},
);
assert.match(readonly, /SYNTHETIC historical payment/);
assert.match(readonly, /data-writable="no"/);
const legacy = render(
{},
{ payments: [{ reference: 'SYNTHETIC legacy draft' }] },
);
assert.match(legacy, /SYNTHETIC legacy draft/);
assert.match(legacy, /data-writable="yes"/);
});
await test('hidden parent answers never reveal nested questions, while reopening the branch restores their answers', () => {
const payload = { root: '0', branch: '1', detail: 'Preserved detail' };
const hidden = render(payload);
@@ -127,3 +173,36 @@ await test('hidden parent answers never reveal nested questions, while reopening
detail: 'Preserved detail',
});
});
await test('return category is optional and comes from the server, while historical labels retain their snapshot', () => {
const props = {
owner: false,
manager: true,
fieldsEditable: false,
transitions: ['returned'],
returnReasons: {
unspecified: 'SYNTHETIC unclassified',
missing_documents: 'SYNTHETIC configured category',
},
events: [
{
id: 'event',
action: 'request_returned',
name: 'SYNTHETIC actor',
created_at: '2026-11-02T10:00:00Z',
payload: { return_reason_label: 'SYNTHETIC historical label' },
},
],
};
const returned = render({}, props);
assert.match(
returned,
/Categoria do motivo \(opcional, para indicadores\)/,
);
assert.match(returned, /SYNTHETIC configured category/);
assert.match(returned, /Categoria:.*SYNTHETIC historical label/);
assert.doesNotMatch(returned, /<select[^>]*required/);
const other = render({}, { ...props, transitions: ['reviewing'] });
assert.doesNotMatch(other, /SYNTHETIC configured category/);
assert.match(other, /SYNTHETIC historical label/);
});