fix(qa): review package one deficits and print layout pending acceptance

This commit is contained in:
2026-11-20 11:53:16 +02:00
parent 64f282c341
commit febb5b0b94
6 changed files with 116 additions and 31 deletions
@@ -21,6 +21,56 @@ import {
restoreSimulationDraft,
} from '../../resources/js/lib/simulation-form.ts';
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';
const tables = buildIntegralFinancialTables(input);
assert.equal(get(tables, 'cashflow', 'Caixa inicial')[1], '-9000.00');
assert.equal(get(tables, 'balance', 'Caixa líquida')[1], '-8720.00');
assert.equal(
get(tables, 'balance', 'Total do passivo')[1],
'10.00',
'only the declared accrued tax, without a fabricated overdraft',
);
assert.equal(
get(tables, 'balance', 'Empréstimos e suprimentos por reembolsar')[1],
'0.00',
);
assert.equal(get(tables, 'balance', 'Total do activo')[1], '-8130.00');
assert.equal(get(tables, 'balance', 'Diferença do balanço')[1], '0.00');
assert.match(
tables.find((table) => table.id === 'balance').notes.join(' '),
/não cria dívida/,
);
});
void test('review regression: print export repeats rubrics in readable slices without losing any of sixty months or five annual periods', async () => {
const input = plan(60);
const report = createProjectDossierReport(
{
project_title: 'QA 60 meses',
business_plan_snapshot: serializeBusinessPlanSnapshot(input),
},
{
selectedSections: new Set(['finance']),
generatedAt: '2026-11-20T12:00:00Z',
},
);
const html = await createProjectDossierPrintHtml(report, []);
const heads = [...html.matchAll(/<thead>([\s\S]*?)<\/thead>/g)];
assert.ok(heads.length > 7);
for (const [, head] of heads)
assert.ok(
(head.match(/<th>/g) ?? []).length <= 5,
'four periods plus rubric maximum',
);
for (const table of report.sections[0].tables)
for (const header of table.headers)
assert.ok(html.includes(header), header);
assert.match(html, /2031-12/);
assert.doesNotMatch(html, /overflow-x:auto/);
});
const get = (tables, id, label) =>
tables
.find((table) => table.id === id)