fix: complete InvesteMoz validation and error corrections
This commit is contained in:
@@ -21,16 +21,48 @@ import {
|
||||
|
||||
void test('an invalid fiscal operation date has a field error and no substitute period', () => {
|
||||
for (const date of ['', '2026-99-99', '2026-02-30', '2025-06-15']) {
|
||||
const draft = { fiscal_period: '2026', fiscal_periodicity: 'one_off', fiscal_scenario_mode: 'approved_parameters', fiscal_reference_date: date };
|
||||
const draft = {
|
||||
fiscal_period: '2026',
|
||||
fiscal_periodicity: 'one_off',
|
||||
fiscal_scenario_mode: 'approved_parameters',
|
||||
fiscal_reference_date: date,
|
||||
};
|
||||
assert.equal(getFiscalPeriodRange(draft), null);
|
||||
assert.match(validateSimulationDraft(draft, 'tax').fiscal_reference_date, /data válida/);
|
||||
assert.match(
|
||||
validateSimulationDraft(draft, 'tax').fiscal_reference_date,
|
||||
/data válida/,
|
||||
);
|
||||
}
|
||||
assert.equal(validateSimulationDraft({ fiscal_period: '2026', fiscal_periodicity: 'one_off', fiscal_scenario_mode: 'approved_parameters', fiscal_reference_date: '2026-06-15' }, 'tax').fiscal_reference_date, undefined);
|
||||
assert.equal(
|
||||
validateSimulationDraft(
|
||||
{
|
||||
fiscal_period: '2026',
|
||||
fiscal_periodicity: 'one_off',
|
||||
fiscal_scenario_mode: 'approved_parameters',
|
||||
fiscal_reference_date: '2026-06-15',
|
||||
},
|
||||
'tax',
|
||||
).fiscal_reference_date,
|
||||
undefined,
|
||||
);
|
||||
});
|
||||
|
||||
void test('fiscal period range requires and respects exact annual, monthly, quarterly, and one-off dates', () => {
|
||||
for (const invalid of ['2026-99-99', '2026-02-30', '2026-00-01', '2026-01-00', '']) {
|
||||
assert.equal(getFiscalPeriodRange({ fiscal_period: '2026', fiscal_periodicity: 'one_off', fiscal_reference_date: invalid }), null);
|
||||
for (const invalid of [
|
||||
'2026-99-99',
|
||||
'2026-02-30',
|
||||
'2026-00-01',
|
||||
'2026-01-00',
|
||||
'',
|
||||
]) {
|
||||
assert.equal(
|
||||
getFiscalPeriodRange({
|
||||
fiscal_period: '2026',
|
||||
fiscal_periodicity: 'one_off',
|
||||
fiscal_reference_date: invalid,
|
||||
}),
|
||||
null,
|
||||
);
|
||||
}
|
||||
assert.deepEqual(
|
||||
getFiscalPeriodRange({
|
||||
@@ -345,7 +377,13 @@ void test('approved-parameter fiscal mode does not ask users to enter a rate', (
|
||||
});
|
||||
|
||||
void test('custom planning mode requires user assumptions and validates percentage limits', () => {
|
||||
assert.deepEqual(validateSimulationDraft({ fiscal_scenario_mode: 'custom_planning' }, 'tax'), {});
|
||||
assert.deepEqual(
|
||||
validateSimulationDraft(
|
||||
{ fiscal_scenario_mode: 'custom_planning' },
|
||||
'tax',
|
||||
),
|
||||
{},
|
||||
);
|
||||
const base = {
|
||||
purpose: 'simulate_only',
|
||||
fiscal_period: '2026',
|
||||
|
||||
Reference in New Issue
Block a user