vrsao 2
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-10-08 14:02:01 +02:00
parent bdd766c68a
commit 1106509116
354 changed files with 48275 additions and 24635 deletions
+44 -7
View File
@@ -1,15 +1,40 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { readRows, exportProjectDossierCsv } from '../../resources/js/lib/project-dossier.ts';
import {
readRows,
exportProjectDossierCsv,
} from '../../resources/js/lib/project-dossier.ts';
import { serializeFinancialToolsSnapshot } from '../../resources/js/lib/financial-calculators.ts';
test('structured planner tolerates incomplete or malformed snapshots', () => {
void test('structured planner tolerates incomplete or malformed snapshots', () => {
assert.deepEqual(readRows('not-json', ['name']), []);
assert.deepEqual(readRows('{"x":1}', ['name']), []);
});
test('project export labels user market claims and insufficient finance evidence', () => {
const csv = exportProjectDossierCsv({ market_assumption: 'procura alta', market_source: '', project_title: '=1+1', project_team_snapshot: JSON.stringify([{ competency: 'Gestão', state: 'gap', action: 'Formação', estimated_cost: '20', due_date: '' }]), project_execution_snapshot: JSON.stringify([{ title: 'Abrir', due_date: '', status: 'planned', planned_amount: '10', actual_amount: '' }]) });
void test('project export labels user market claims and insufficient finance evidence', () => {
const csv = exportProjectDossierCsv({
market_assumption: 'procura alta',
market_source: '',
project_title: '=1+1',
project_team_snapshot: JSON.stringify([
{
competency: 'Gestão',
state: 'gap',
action: 'Formação',
estimated_cost: '20',
due_date: '',
},
]),
project_execution_snapshot: JSON.stringify([
{
title: 'Abrir',
due_date: '',
status: 'planned',
planned_amount: '10',
actual_amount: '',
},
]),
});
assert.match(csv, /Informação declarada, não verificada/);
assert.match(csv, /Informação insuficiente/);
assert.match(csv, /'=1\+1/);
@@ -18,16 +43,28 @@ test('project export labels user market claims and insufficient finance evidence
assert.match(csv, /Marco 1/);
});
test('project dossier exports readable financial assumptions and verified calculator outputs', () => {
void test('project dossier exports readable financial assumptions and verified calculator outputs', () => {
const financial_tools_snapshot = serializeFinancialToolsSnapshot({
budgetPeriod: 'Mensal',
loan: { principal: '100000', rate: '18', months: '24', rateType: 'nominal', periodMonths: '1', gracePeriods: '0', upfrontFee: '0', recurringFee: '0' },
loan: {
principal: '100000',
rate: '18',
months: '24',
rateType: 'nominal',
periodMonths: '1',
gracePeriods: '0',
upfrontFee: '0',
recurringFee: '0',
},
breakEven: { fixed: '50000', price: '1000', variable: '600' },
funding: { total: '1000000', secured: '250000' },
incomes: [{ label: 'Vendas', amount: '200000' }],
expenses: [{ label: 'Operação', amount: '150000' }],
});
const csv = exportProjectDossierCsv({ financial_tools_snapshot, currency: 'MZN' });
const csv = exportProjectDossierCsv({
financial_tools_snapshot,
currency: 'MZN',
});
assert.match(csv, /Unidades estimadas;125;/);
assert.match(csv, /Diferença por financiar;750000\.00 MZN;/);
assert.match(csv, /Saldo operacional estimado;50000\.00 MZN;/);