Entrega dashboard e correccoes transversais preservando Ofertas instalado
tests / ci (push) Canceled after 0s
tests / ci (push) Canceled after 0s
This commit is contained in:
@@ -138,6 +138,37 @@ function fixture() {
|
||||
};
|
||||
}
|
||||
|
||||
test('a planning budget remains an interval in the same dossier report without inventing an investment amount', () => {
|
||||
const input = fixture();
|
||||
input.context_opportunity = null;
|
||||
input.opportunity_options = [];
|
||||
input.preparation_report.opportunity = null;
|
||||
Object.assign(input.investment_context.fields, {
|
||||
investment_budget_min: '1000000',
|
||||
investment_budget_max: '5000000',
|
||||
currency: 'MZN',
|
||||
});
|
||||
const report = createInvestorDossierReport(input, '2026-11-15T12:00:00Z');
|
||||
const section = report.sections.find((section) => section.id === 'project');
|
||||
assert.equal(
|
||||
section.rows.find(
|
||||
(row) => row.field === 'Orçamento previsto — mínimo do intervalo',
|
||||
).value,
|
||||
'1000000',
|
||||
);
|
||||
assert.equal(
|
||||
section.rows.find(
|
||||
(row) => row.field === 'Orçamento previsto — máximo do intervalo',
|
||||
).value,
|
||||
'5000000',
|
||||
);
|
||||
assert.equal(
|
||||
section.rows.some((row) => row.field === 'Investimento previsto'),
|
||||
false,
|
||||
);
|
||||
assert.equal(input.context_opportunity, null);
|
||||
});
|
||||
|
||||
void test('one dossier groups stage evidence, SWOT, fiscal and all preserved APIEX versions without modifying sources', () => {
|
||||
const input = fixture();
|
||||
input.documents.push({ ...input.documents[0], id: 'second-link' });
|
||||
@@ -202,6 +233,7 @@ void test('financial results from a different opportunity do not enter the conso
|
||||
id: 'other',
|
||||
context_opportunity: 'op-b',
|
||||
financial_snapshot: 'OTHER-PRIVATE-INPUTS',
|
||||
preparation_snapshot: { annual_revenue: 'OTHER-PRIVATE-PREPARATION' },
|
||||
draft_id: 'other-draft',
|
||||
draft_version: 8,
|
||||
recorded_at: '2026-11-13',
|
||||
@@ -214,6 +246,7 @@ void test('financial results from a different opportunity do not enter the conso
|
||||
'OTHER-PRIVATE-INPUTS',
|
||||
),
|
||||
);
|
||||
assert.equal(JSON.stringify(createInvestorDossierReport(input)).includes('OTHER-PRIVATE-PREPARATION'), false);
|
||||
assert.ok(
|
||||
!investorDossierReportIndex(input).some(
|
||||
(entry) => entry.id === 'finance:other',
|
||||
@@ -249,6 +282,7 @@ void test('the consolidated report reuses loan, break-even, financing and budget
|
||||
input.results = [
|
||||
{
|
||||
id: 'finance-a',
|
||||
preparation_snapshot: { total_investment: '100000', investment_budget_min: '1000000', investment_budget_max: '5000000', annual_revenue: '7500000', planning_assumptions_snapshot: JSON.stringify({ version: 1, data: { model: 'hotel', capacity: '10', price: '5000', occupancy: '50', frequency: '300', source: 'Synthetic assumptions', costs: [{ label: 'Energia', annual: '' }] } }), initial_budget_snapshot: JSON.stringify({ version: 1, rows: [{ label: 'Equipamento', amount: '100000' }] }) },
|
||||
context_opportunity: 'op-a',
|
||||
context_revision: 2,
|
||||
context_state: 'review_required',
|
||||
@@ -287,6 +321,18 @@ void test('the consolidated report reuses loan, break-even, financing and budget
|
||||
);
|
||||
assert.match(rows[0].classification, /Histórico/);
|
||||
assert.equal(input.results[0].financial_snapshot, financial_snapshot);
|
||||
assert.equal(rows.find(item => item.field === 'Receitas anuais estimadas').value, '7500000 MZN');
|
||||
assert.equal(rows.find(item => item.field === 'Quartos disponíveis').value, '10');
|
||||
assert.equal(rows.find(item => item.field === 'Custo anual — Energia').value, 'Por confirmar');
|
||||
assert.equal(rows.find(item => item.field === 'Investimento inicial — Equipamento').value, '100000');
|
||||
});
|
||||
|
||||
test('funding remains calculable without presenting an unchosen empty loan or empty comparisons', () => {
|
||||
const input = fixture();
|
||||
input.results = [{ id: 'funding-only', context_opportunity: 'op-a', context_revision: 3, currency: 'MZN', draft_id: 'draft-a', draft_version: 1, recorded_at: '2026-11-15', engine: 'financial-calculators:v1', preparation_snapshot: { planning_loan: 'no' }, financial_snapshot: serializeFinancialToolsSnapshot({ budgetPeriod: 'Mensal', loan: { principal: '', rate: '', months: '', rateType: 'nominal', periodMonths: '1', gracePeriods: '', upfrontFee: '', recurringFee: '' }, breakEven: { fixed: '', price: '', variable: '' }, funding: { total: '1000000', secured: '1000000' }, incomes: [{ label: 'Receita', amount: '' }], expenses: [{ label: 'Custos', amount: '' }] }) }];
|
||||
const rows = createInvestorDossierReport(input).sections.find(section => section.id === 'finance').rows;
|
||||
assert.equal(rows.find(row => row.field === 'Financiamento — Diferença por financiar').value, '0.00 MZN');
|
||||
assert.equal(rows.some(row => /Empréstimo educativo|Ponto de equilíbrio|Orçamento —/.test(row.field)), false);
|
||||
});
|
||||
|
||||
void test('the existing Word and print exporters retain dossier identity, pending stages, source and history, escaping active HTML', async () => {
|
||||
|
||||
Reference in New Issue
Block a user