@@ -17,7 +17,7 @@ function cents(value) {
|
||||
return BigInt(whole) * 100n + BigInt(fraction.padEnd(2, '0'));
|
||||
}
|
||||
|
||||
test('financial tools snapshot persists editable calculations and rejects malformed data', () => {
|
||||
void test('financial tools snapshot persists editable calculations and rejects malformed data', () => {
|
||||
const data = {
|
||||
budgetPeriod: 'Mensal',
|
||||
loan: {
|
||||
@@ -59,7 +59,7 @@ test('financial tools snapshot persists editable calculations and rejects malfor
|
||||
);
|
||||
});
|
||||
|
||||
test('loan payment handles zero interest exactly', () => {
|
||||
void test('loan payment handles zero interest exactly', () => {
|
||||
assert.deepEqual(calculateLoanPayment('1200.00', '0', 12), {
|
||||
monthlyPayment: '100.00',
|
||||
totalPaid: '1200.00',
|
||||
@@ -67,7 +67,7 @@ test('loan payment handles zero interest exactly', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('loan payment computes a reproducible amortized estimate', () => {
|
||||
void test('loan payment computes a reproducible amortized estimate', () => {
|
||||
assert.deepEqual(calculateLoanPayment('1000.00', '12', 12), {
|
||||
monthlyPayment: '88.85',
|
||||
totalPaid: '1066.19',
|
||||
@@ -75,7 +75,7 @@ test('loan payment computes a reproducible amortized estimate', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('break-even rounds required units upward and rejects nonpositive margin', () => {
|
||||
void test('break-even rounds required units upward and rejects nonpositive margin', () => {
|
||||
assert.deepEqual(calculateBreakEven('100.00', '30.00', '20.00'), {
|
||||
contributionPerUnit: '10.00',
|
||||
breakEvenUnits: '10',
|
||||
@@ -85,7 +85,7 @@ test('break-even rounds required units upward and rejects nonpositive margin', (
|
||||
assert.throws(() => calculateBreakEven('10', '20', '20'), /superior/);
|
||||
});
|
||||
|
||||
test('an invalid indicator does not hide independent financial calculations', () => {
|
||||
void test('an invalid indicator does not hide independent financial calculations', () => {
|
||||
const result = calculateFinancialTools({
|
||||
loan: {
|
||||
principal: '1200',
|
||||
@@ -110,7 +110,7 @@ test('an invalid indicator does not hide independent financial calculations', ()
|
||||
assert.equal(result.budget.value?.operatingBalance, '-100.00');
|
||||
});
|
||||
|
||||
test('funding gap distinguishes zero from a negative surplus', () => {
|
||||
void test('funding gap distinguishes zero from a negative surplus', () => {
|
||||
assert.deepEqual(calculateFundingGap('100.00', '120.00'), {
|
||||
gap: '-20.00',
|
||||
reconciles: false,
|
||||
@@ -118,12 +118,12 @@ test('funding gap distinguishes zero from a negative surplus', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('invalid precision and negative inputs are rejected', () => {
|
||||
void test('invalid precision and negative inputs are rejected', () => {
|
||||
assert.throws(() => calculateFundingGap('-1', '0'), /decimal/);
|
||||
assert.throws(() => calculateLoanPayment('1.001', '0', 1), /casas/);
|
||||
});
|
||||
|
||||
test('loan schedule supports nominal rates, interest-only grace and separate fees', () => {
|
||||
void test('loan schedule supports nominal rates, interest-only grace and separate fees', () => {
|
||||
const result = buildLoanSchedule({
|
||||
principal: '1200.00',
|
||||
annualRatePercent: '12',
|
||||
@@ -159,7 +159,7 @@ test('loan schedule supports nominal rates, interest-only grace and separate fee
|
||||
}
|
||||
});
|
||||
|
||||
test('loan schedule reconciles exact cents and adjusts the final installment', () => {
|
||||
void test('loan schedule reconciles exact cents and adjusts the final installment', () => {
|
||||
const result = buildLoanSchedule({
|
||||
principal: '1000.01',
|
||||
annualRatePercent: '7.123456',
|
||||
@@ -181,7 +181,7 @@ test('loan schedule reconciles exact cents and adjusts the final installment', (
|
||||
);
|
||||
});
|
||||
|
||||
test('effective annual rate is converted to the selected repayment period', () => {
|
||||
void test('effective annual rate is converted to the selected repayment period', () => {
|
||||
const result = buildLoanSchedule({
|
||||
principal: '1000',
|
||||
annualRatePercent: '12',
|
||||
@@ -203,7 +203,7 @@ test('effective annual rate is converted to the selected repayment period', () =
|
||||
assert.equal(quarterly.schedule.at(-1).closingBalance, '0.00');
|
||||
});
|
||||
|
||||
test('loan schedules reconcile across rates, periodicities and grace periods', () => {
|
||||
void test('loan schedules reconcile across rates, periodicities and grace periods', () => {
|
||||
for (const periodMonths of [1, 2, 3, 4, 6, 12]) {
|
||||
for (const rateType of ['nominal', 'effective']) {
|
||||
for (const annualRatePercent of ['0', '8.500000', '24']) {
|
||||
@@ -254,7 +254,7 @@ test('loan schedules reconcile across rates, periodicities and grace periods', (
|
||||
}
|
||||
});
|
||||
|
||||
test('budget preserves an operating deficit and rejects invalid values', () => {
|
||||
void test('budget preserves an operating deficit and rejects invalid values', () => {
|
||||
assert.deepEqual(calculateBudget(['100.00', '25.50'], ['140.00']), {
|
||||
incomeTotal: '125.50',
|
||||
expenseTotal: '140.00',
|
||||
@@ -264,7 +264,7 @@ test('budget preserves an operating deficit and rejects invalid values', () => {
|
||||
assert.throws(() => calculateBudget(['0'], ['-1']), /não negativo/);
|
||||
});
|
||||
|
||||
test('budget distinguishes absent income or expense rows from explicit zero', () => {
|
||||
void test('budget distinguishes absent income or expense rows from explicit zero', () => {
|
||||
assert.throws(() => calculateBudget([], ['0']), /pelo menos uma linha/);
|
||||
assert.throws(() => calculateBudget(['0'], []), /pelo menos uma linha/);
|
||||
assert.deepEqual(calculateBudget(['0'], ['0']), {
|
||||
@@ -275,7 +275,7 @@ test('budget distinguishes absent income or expense rows from explicit zero', ()
|
||||
});
|
||||
});
|
||||
|
||||
test('loan terms reject invalid periodicity, excessive grace and commission larger than principal', () => {
|
||||
void test('loan terms reject invalid periodicity, excessive grace and commission larger than principal', () => {
|
||||
const base = {
|
||||
principal: '1000',
|
||||
annualRatePercent: '0',
|
||||
@@ -297,7 +297,7 @@ test('loan terms reject invalid periodicity, excessive grace and commission larg
|
||||
);
|
||||
});
|
||||
|
||||
test('financial tools CSV records reproducible assumptions, periods, formulas and matching results', () => {
|
||||
void test('financial tools CSV records reproducible assumptions, periods, formulas and matching results', () => {
|
||||
const csv = exportFinancialToolsCsv({
|
||||
currency: 'MZN',
|
||||
generatedAt: '2026-10-02T10:00:00.000Z',
|
||||
|
||||
Reference in New Issue
Block a user