fix(qa): evaluate credit warnings from declared contractual days
This commit is contained in:
@@ -398,6 +398,10 @@ void test('actual editor controls preserve declarations through snapshot reload
|
||||
target: { checked: true },
|
||||
});
|
||||
assert.equal(plan.applyAnnualGrowth, true);
|
||||
field('Prazo de recebimento a crédito').props.onChange({
|
||||
target: { value: '91' },
|
||||
});
|
||||
assert.equal(plan.creditTermDays, '91');
|
||||
field('Planear dividendos').props.onChange({ target: { checked: true } });
|
||||
field('Dividendos, mês 1').props.onChange({ target: { value: '12.25' } });
|
||||
assert.equal(plan.dividendsByPeriod[0], '12.25');
|
||||
@@ -411,3 +415,28 @@ void test('actual editor controls preserve declarations through snapshot reload
|
||||
assert.equal(plan.dividendsByPeriod[0], '12.25');
|
||||
assert.equal(plan.products[0].monthlyUnits, '10');
|
||||
});
|
||||
|
||||
void test('the credit warning uses the declared 90-day boundary without converting or changing monthly cash flows', () => {
|
||||
const p = financialReportFixture(12),
|
||||
baseline = forecastBusinessPlan(p);
|
||||
for (const days of ['0', '30', '90', '91', '365']) {
|
||||
p.creditTermDays = days;
|
||||
const restored = reload(p);
|
||||
assert.equal(restored.creditTermDays, days);
|
||||
assert.deepEqual(forecastBusinessPlan(restored), baseline);
|
||||
assert.equal(
|
||||
financialPlanWarnings(
|
||||
restored,
|
||||
buildIntegralFinancialTables(restored),
|
||||
).some((w) => w.id.endsWith('-credit')),
|
||||
Number(days) > 90,
|
||||
);
|
||||
}
|
||||
for (const invalid of ['-1', '366', '30.5', 'abc']) {
|
||||
p.creditTermDays = invalid;
|
||||
assert.throws(
|
||||
() => forecastBusinessPlan(p),
|
||||
/prazo entre 0 e 365 dias/,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user