test: align deployment checks with accepted diagnostics and public presentation
tests / ci (push) Waiting to run
tests / ci (push) Waiting to run
This commit is contained in:
@@ -313,7 +313,7 @@ void test('monthly unit schedules must match the horizon and contain valid quant
|
||||
},
|
||||
],
|
||||
}),
|
||||
/Quantidade/,
|
||||
/Previs\u00e3o de Vendas \/ Unidades do produto 1, m\u00eas 1: .*tr\u00eas casas decimais/,
|
||||
);
|
||||
assert.throws(
|
||||
() =>
|
||||
@@ -327,7 +327,7 @@ void test('monthly unit schedules must match the horizon and contain valid quant
|
||||
},
|
||||
],
|
||||
}),
|
||||
/Quantidade/,
|
||||
/Previs\u00e3o de Vendas \/ Unidades do produto 1, m\u00eas 1: .*tr\u00eas casas decimais/,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -412,7 +412,7 @@ void test('monthly money schedules cover the horizon and reject invalid amounts'
|
||||
},
|
||||
],
|
||||
}),
|
||||
/não negativo/,
|
||||
/Este valor n\u00e3o pode ser negativo\./,
|
||||
);
|
||||
assert.throws(
|
||||
() =>
|
||||
@@ -503,7 +503,7 @@ void test('monthly operating schedules require full horizon, exact cents and cur
|
||||
periods: 1,
|
||||
monthlyPayrollExpenseByPeriod: ['-1'],
|
||||
}),
|
||||
/não negativo/,
|
||||
/Este valor n\u00e3o pode ser negativo\./,
|
||||
);
|
||||
const restored = restoreBusinessPlanSnapshot(
|
||||
serializeBusinessPlanSnapshot({
|
||||
@@ -611,7 +611,7 @@ void test('missing currency, products, invalid numbers and invalid horizons are
|
||||
assert.throws(
|
||||
() =>
|
||||
forecastBusinessPlan({ ...assumptions, monthlyCollections: '-10' }),
|
||||
/não negativo/,
|
||||
/Este valor n\u00e3o pode ser negativo\./,
|
||||
);
|
||||
assert.throws(
|
||||
() => forecastBusinessPlan({ ...assumptions, periods: 61 }),
|
||||
@@ -1067,7 +1067,7 @@ void test('scheduled collection percentage keeps unpaid invoices in receivables
|
||||
salesCollectionLagMonths: 0,
|
||||
salesCollectionPercent: '100.01',
|
||||
}),
|
||||
/entre 0 e 100/,
|
||||
/Introduza uma percentagem entre 0% e 100%\./,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1126,7 +1126,7 @@ void test('sales recovery applies only to overdue invoices and never exceeds ope
|
||||
salesCollectionLagMonths: 0,
|
||||
salesRecoverySchedule: [{ month: 1, percent: '100.01' }],
|
||||
}),
|
||||
/entre 0 e 100/,
|
||||
/Introduza uma percentagem entre 0% e 100%\./,
|
||||
);
|
||||
assert.throws(
|
||||
() =>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import * as issuePresentation from '../../resources/js/lib/financial-issue-presentation.ts';
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import fs from 'node:fs';
|
||||
@@ -78,6 +79,20 @@ function editor(initialSnapshot) {
|
||||
? { SimulationAnnualExample: () => null }
|
||||
: undefined) ??
|
||||
{
|
||||
'./warning-limits-editor': { WarningLimitsEditor: () => null },
|
||||
'@/components/supplier-advances': {
|
||||
SupplierAdvancesEditor: () => null,
|
||||
},
|
||||
'@/components/period-investments': {
|
||||
PeriodInvestmentsEditor: () => null,
|
||||
},
|
||||
'@/components/financial-day-terms': {
|
||||
FinancialDayTerms: () => null,
|
||||
},
|
||||
'@/components/startup-asset-requirements': {
|
||||
StartupAssetRequirements: () => null,
|
||||
},
|
||||
'@/lib/financial-issue-presentation': issuePresentation,
|
||||
react: hooks,
|
||||
'@/components/currency-select': { CurrencySelect: () => null },
|
||||
'@/lib/business-financial-plan': business,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import * as publicPresentation from '../../resources/js/lib/public-presentation.ts';
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
@@ -21,7 +22,11 @@ function load(file, mocks = {}) {
|
||||
).outputText;
|
||||
const module = { exports: {} };
|
||||
compileFunction(output, ['require', 'module', 'exports'])(
|
||||
(name) => mocks[name] ?? require(name),
|
||||
(name) =>
|
||||
mocks[name] ??
|
||||
(name === '@/lib/public-presentation'
|
||||
? publicPresentation
|
||||
: require(name)),
|
||||
module,
|
||||
module.exports,
|
||||
);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import * as publicPresentation from '../../resources/js/lib/public-presentation.ts';
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
@@ -20,7 +21,11 @@ function load(file, mocks) {
|
||||
).outputText;
|
||||
const module = { exports: {} };
|
||||
compileFunction(output, ['require', 'module', 'exports'])(
|
||||
(name) => mocks[name] ?? require(name),
|
||||
(name) =>
|
||||
mocks[name] ??
|
||||
(name === '@/lib/public-presentation'
|
||||
? publicPresentation
|
||||
: require(name)),
|
||||
module,
|
||||
module.exports,
|
||||
);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import * as publicPresentation from '../../resources/js/lib/public-presentation.ts';
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
@@ -28,7 +29,11 @@ function load(file, mocks) {
|
||||
).outputText;
|
||||
const module = { exports: {} };
|
||||
compileFunction(output, ['require', 'module', 'exports'])(
|
||||
(name) => mocks[name] ?? require(name),
|
||||
(name) =>
|
||||
mocks[name] ??
|
||||
(name === '@/lib/public-presentation'
|
||||
? publicPresentation
|
||||
: require(name)),
|
||||
module,
|
||||
module.exports,
|
||||
);
|
||||
|
||||
@@ -165,7 +165,11 @@ void test('real table component presents one issue panel while retaining every t
|
||||
const html = renderToStaticMarkup(
|
||||
React.createElement(module.exports.InvestmentReportTables, { tables }),
|
||||
);
|
||||
assert.equal(html.split(message).length - 1, 1);
|
||||
assert.equal(
|
||||
html.replace(/ data-correction-message="[^"]*"/g, '').split(message)
|
||||
.length - 1,
|
||||
1,
|
||||
);
|
||||
assert.equal(
|
||||
(html.match(/aria-label="Dados financeiros a corrigir"/g) ?? []).length,
|
||||
1,
|
||||
@@ -199,7 +203,11 @@ void test('print and Word present the same capital correction only once, without
|
||||
report.sections.find((s) => s.id === 'finance').tables,
|
||||
)[0].message;
|
||||
const html = await createProjectDossierPrintHtml(report, []);
|
||||
assert.equal(html.split(message).length - 1, 1);
|
||||
assert.equal(
|
||||
html.replace(/ data-correction-message="[^"]*"/g, '').split(message)
|
||||
.length - 1,
|
||||
1,
|
||||
);
|
||||
const blob = await generateProjectDossierDocx(report, []),
|
||||
zip = await JSZip.loadAsync(
|
||||
blob instanceof Blob ? await blob.arrayBuffer() : blob,
|
||||
|
||||
@@ -7,14 +7,53 @@ import React from 'react';
|
||||
import { renderToStaticMarkup } from 'react-dom/server';
|
||||
import ts from 'typescript';
|
||||
import * as forms from '../../resources/js/lib/fiscal-form-preparation.ts';
|
||||
const require=createRequire(import.meta.url);
|
||||
const source=fs.readFileSync(new URL('../../resources/js/pages/portal/fiscal-forms.tsx',import.meta.url),'utf8');
|
||||
const compiled=ts.transpileModule(source,{compilerOptions:{module:ts.ModuleKind.CommonJS,target:ts.ScriptTarget.ES2022,jsx:ts.JsxEmit.ReactJSX}}).outputText;
|
||||
const module={exports:{}};
|
||||
new Function('require','module','exports',compiled)(name=>name==='@inertiajs/react'?{Head:()=>null,Link:({href,children,...props})=>React.createElement('a',{href,...props},children),router:{on:()=>()=>{}}}:name==='@/components/portal-menu'?{PortalMenu:()=>null}:name==='@/lib/fiscal-form-preparation'?forms:require(name),module,module.exports);
|
||||
test('fiscal entry renders labelled editable fields and a guided preparation rather than legislation',()=>{
|
||||
const html=renderToStaticMarkup(React.createElement(module.exports.default));
|
||||
for(const label of ['Identificação e período','Nome ou designação social','NUIT','Período — ano e mês','Conferir e guardar','Guardar ficheiro para continuar','Recuperar ficheiro guardado','Confirmar recuperação']) {
|
||||
const require = createRequire(import.meta.url);
|
||||
const source = fs.readFileSync(
|
||||
new URL(
|
||||
'../../resources/js/pages/portal/fiscal-forms.tsx',
|
||||
import.meta.url,
|
||||
),
|
||||
'utf8',
|
||||
);
|
||||
const compiled = ts.transpileModule(source, {
|
||||
compilerOptions: {
|
||||
module: ts.ModuleKind.CommonJS,
|
||||
target: ts.ScriptTarget.ES2022,
|
||||
jsx: ts.JsxEmit.ReactJSX,
|
||||
},
|
||||
}).outputText;
|
||||
const module = { exports: {} };
|
||||
new Function('require', 'module', 'exports', compiled)(
|
||||
(name) =>
|
||||
name === '@inertiajs/react'
|
||||
? {
|
||||
Head: () => null,
|
||||
Link: ({ href, children, ...props }) =>
|
||||
React.createElement('a', { href, ...props }, children),
|
||||
router: { on: () => () => {} },
|
||||
}
|
||||
: name === '@/components/portal-menu'
|
||||
? { PortalMenu: () => null }
|
||||
: name === '@/lib/fiscal-form-preparation'
|
||||
? forms
|
||||
: require(name),
|
||||
module,
|
||||
module.exports,
|
||||
);
|
||||
test('fiscal entry renders labelled editable fields and a guided preparation rather than legislation', () => {
|
||||
const html = renderToStaticMarkup(
|
||||
React.createElement(module.exports.default),
|
||||
);
|
||||
for (const label of [
|
||||
'Identificação e período',
|
||||
'Nome ou designação social',
|
||||
'NUIT',
|
||||
'Período — ano e mês',
|
||||
'Conferir e guardar',
|
||||
'Guardar ficheiro para continuar',
|
||||
'Recuperar ficheiro guardado',
|
||||
'Confirmar recuperação',
|
||||
]) {
|
||||
// Confirmation appears only after a compatible file is selected.
|
||||
if (label !== 'Confirmar recuperação')
|
||||
assert.ok(html.includes(label), label);
|
||||
@@ -29,7 +68,10 @@ void test('IRPC entry opens the requested form directly and keeps its partial co
|
||||
React.createElement(module.exports.default, { initialTax: 'irpc' }),
|
||||
);
|
||||
assert.match(html, /IRPC — Modelo 22/);
|
||||
assert.match(html, /L8 permanece parcial/);
|
||||
assert.match(
|
||||
html,
|
||||
/não há apuramento automático nem confirmação de elegibilidade/,
|
||||
);
|
||||
assert.match(html, /303 — Dupla tributação económica/);
|
||||
assert.match(html, /304 — Dupla tributação internacional/);
|
||||
assert.match(html, /Não utilize a mesma parcela/);
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"records": {
|
||||
"moza": {
|
||||
"id": "53119370-3dcc-4488-b469-80ffcd24ece2"
|
||||
},
|
||||
"bci": {
|
||||
"id": "9ba03e9c-850a-415b-8caa-a7092aa8db25"
|
||||
},
|
||||
"standard-bank": {
|
||||
"id": "1b5f6e6b-4c3e-477a-a847-74803719f8fd"
|
||||
},
|
||||
"ac-microbanco": {
|
||||
"id": "e6c7c1b7-cbf0-4c69-ad4e-0d02f18fa136"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -182,10 +182,7 @@ test('B06 empty results omit institution alternatives and real result links keep
|
||||
0,
|
||||
);
|
||||
const fixture = JSON.parse(
|
||||
fs.readFileSync(
|
||||
'outputs/funding-b03-b06-20261120/fixture.json',
|
||||
'utf8',
|
||||
),
|
||||
fs.readFileSync('tests/frontend/fixtures/funding-b03-b06.json', 'utf8'),
|
||||
);
|
||||
const originals = JSON.parse(
|
||||
fs.readFileSync(
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import * as fieldCorrections from '../../resources/js/lib/field-corrections.ts';
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
@@ -72,6 +73,10 @@ function load(name) {
|
||||
);
|
||||
return module.exports.default;
|
||||
}
|
||||
mocks['@/lib/field-corrections'] = fieldCorrections;
|
||||
mocks['@/components/portal-corrections'] = {
|
||||
default: load('components/portal-corrections.tsx'),
|
||||
};
|
||||
const PortalNavigation = load('layouts/portal-navigation.tsx'),
|
||||
AppHeaderLayout = load('layouts/app/app-header-layout.tsx');
|
||||
mocks['@/layouts/app/app-header-layout'] = { default: AppHeaderLayout };
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import * as publicPresentation from '../../resources/js/lib/public-presentation.ts';
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
@@ -46,7 +47,9 @@ compileFunction(
|
||||
return { TerritoryFields: () => null };
|
||||
if (name === '../management/shared' || name === './shared')
|
||||
return shared;
|
||||
return require(name);
|
||||
return name === '@/lib/public-presentation'
|
||||
? publicPresentation
|
||||
: require(name);
|
||||
},
|
||||
module,
|
||||
module.exports,
|
||||
|
||||
@@ -27,7 +27,10 @@ function load(file, mocks = {}) {
|
||||
return {
|
||||
Link: ({ children, ...props }) =>
|
||||
React.createElement('a', props, children),
|
||||
usePage: () => ({ url: '/sectores/test', props: { auth: { user: { id: 1 } } } }),
|
||||
usePage: () => ({
|
||||
url: '/sectores/test',
|
||||
props: { auth: { user: { id: 1 } } },
|
||||
}),
|
||||
};
|
||||
if (id.startsWith('.') || id.startsWith('@/')) {
|
||||
const base = id.startsWith('@/')
|
||||
@@ -111,7 +114,10 @@ test('demographic comparison retains four saved places and requires a province b
|
||||
test('the real preparation editor opens an own idea with its budget and no mandatory advert or duplicate reference selector', () => {
|
||||
const Empty = () => null;
|
||||
const Editor = load('pages/investor-path/context.tsx', {
|
||||
'@/components/investment-step-help': { HelpAtStep: Empty, InvestmentHelpGuide: ({ children }) => children },
|
||||
'@/components/investment-step-help': {
|
||||
HelpAtStep: Empty,
|
||||
InvestmentHelpGuide: ({ children }) => children,
|
||||
},
|
||||
'@/pages/investment/shared': {
|
||||
Frame: ({ children }) =>
|
||||
React.createElement('main', null, children),
|
||||
@@ -413,11 +419,10 @@ test('demography shows original latest total, period, projection and decision wa
|
||||
],
|
||||
};
|
||||
const html = render('components/demographic-evidence.tsx', { evidence });
|
||||
assert.match(html, /1 234/);
|
||||
assert.match(html, /1[\u00a0\u202f ]234/);
|
||||
assert.match(html, /não demonstram procura ou rentabilidade/);
|
||||
assert.match(html, /Projecção/);
|
||||
assert.match(html, /SHA256/);
|
||||
assert.ok(html.indexOf('SHA256') > html.indexOf('<summary'));
|
||||
assert.doesNotMatch(html, /SHA256|QA\.xlsx|123abc/);
|
||||
assert.doesNotMatch(html, /<details[^>]*\bopen/);
|
||||
});
|
||||
test('cluster analysis omits empty field blocks but keeps documented evidence and uncertainty', () => {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import * as publicPresentation from '../../resources/js/lib/public-presentation.ts';
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
@@ -65,7 +66,9 @@ function harness() {
|
||||
}),
|
||||
),
|
||||
}
|
||||
: require(name),
|
||||
: name === '@/lib/public-presentation'
|
||||
? publicPresentation
|
||||
: require(name),
|
||||
module,
|
||||
module.exports,
|
||||
);
|
||||
|
||||
@@ -88,18 +88,32 @@ test('D1: one startup diagnostic across real local and report components; standa
|
||||
),
|
||||
);
|
||||
assert.ok(error.includes('caixa requerida'));
|
||||
assert.equal(render().split(error).length - 1, 1);
|
||||
assert.equal(
|
||||
render()
|
||||
.replace(/ data-correction-message="[^"]*"/g, '')
|
||||
.replace(/ data-correction-message="[^"]*"/g, '')
|
||||
.split(error).length - 1,
|
||||
1,
|
||||
);
|
||||
assert.equal(
|
||||
renderToStaticMarkup(
|
||||
React.createElement(StartupAssetRequirements, {
|
||||
plan,
|
||||
onChange() {},
|
||||
}),
|
||||
).split(error).length - 1,
|
||||
)
|
||||
.replace(/ data-correction-message="[^"]*"/g, '')
|
||||
.split(error).length - 1,
|
||||
1,
|
||||
);
|
||||
plan.reportAssumptions.startupExpenses = 'invalid';
|
||||
assert.equal(render().split(error).length - 1, 1);
|
||||
assert.equal(
|
||||
render()
|
||||
.replace(/ data-correction-message="[^"]*"/g, '')
|
||||
.replace(/ data-correction-message="[^"]*"/g, '')
|
||||
.split(error).length - 1,
|
||||
1,
|
||||
);
|
||||
plan.reportSource = 'annual_example';
|
||||
assert.equal(presentation.forecastErrorShownInReport(plan, error), false);
|
||||
plan.startupAssetRequirements.cashRequired = '0';
|
||||
|
||||
Reference in New Issue
Block a user