fix: validate simulator dates and reconcile QA calculations reports and language
This commit is contained in:
@@ -19,6 +19,15 @@ import {
|
||||
getFiscalPeriodRange,
|
||||
} from '../../resources/js/lib/simulation-form.ts';
|
||||
|
||||
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 };
|
||||
assert.equal(getFiscalPeriodRange(draft), null);
|
||||
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);
|
||||
});
|
||||
|
||||
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);
|
||||
@@ -336,6 +345,7 @@ 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'), {});
|
||||
const base = {
|
||||
purpose: 'simulate_only',
|
||||
fiscal_period: '2026',
|
||||
|
||||
Reference in New Issue
Block a user