fix(qa): reconcile report summary and separate Word period tables

This commit is contained in:
2026-11-20 12:14:08 +02:00
parent d367e18eec
commit 722322f9f6
6 changed files with 157 additions and 4 deletions
@@ -21,6 +21,36 @@ import {
restoreSimulationDraft,
} from '../../resources/js/lib/simulation-form.ts';
void test('acceptance regression: summary uses the same cash, tax payments and startup funding gap as its seven tables', () => {
const input = plan(13);
const make = () =>
createProjectDossierReport(
{
project_title: 'QA',
business_plan_snapshot: serializeBusinessPlanSnapshot(input),
},
{ selectedSections: new Set(['finance']) },
).sections[0];
const finance = make();
const value = (field) =>
finance.rows.find((row) => row.field === field)?.value;
assert.equal(value('Caixa final projectada'), '4 540,00 MZN');
assert.equal(value('Pagamentos no horizonte'), '9 360,00 MZN');
assert.equal(value('Resultado antes de impostos'), '3 770,00 MZN');
assert.equal(value('Resultado líquido no horizonte'), '3 380,00 MZN');
assert.equal(value('Diferença entre usos e fontes'), '100,00 MZN');
assert.match(
value('Reconciliação do financiamento'),
/insuficiente.*não bloqueante/,
);
assert.equal(get(finance.tables, 'cashflow', 'Caixa final')[13], '4540.00');
input.reportAssumptions.taxExpenseByMonth[0] = '';
assert.match(
make().rows.find((row) => row.field === 'Caixa final projectada').value,
/Por determinar/,
);
});
void test('review regression: cash deficit does not create an undeclared loan or inflate projected liabilities', () => {
const input = plan(12);
input.reportAssumptions.startupExpenses[0].amount = '10000';
@@ -221,5 +251,6 @@ void test('dossier print and Word exports include the same seven statements, esc
const xml = await zip.file('word/document.xml').async('string');
assert.match(xml, /Balanço Projectado/);
assert.match(xml, /Lucros e Perdas/);
assert.doesNotMatch(xml, /<\/w:tbl>\s*<w:tbl>/);
assert.match(xml, /7 620,00|7620,00|4 540,00|4540,00/);
});