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
+88 -56
View File
@@ -19,7 +19,7 @@ import {
getFiscalPeriodRange,
} from '../../resources/js/lib/simulation-form.ts';
test('fiscal period range requires and respects exact annual, monthly, quarterly, and one-off dates', () => {
void test('fiscal period range requires and respects exact annual, monthly, quarterly, and one-off dates', () => {
assert.deepEqual(
getFiscalPeriodRange({
fiscal_period: '2024',
@@ -68,7 +68,7 @@ test('fiscal period range requires and respects exact annual, monthly, quarterly
);
});
test('searchable choice keyboard navigation starts at the first result and stays in bounds', () => {
void test('searchable choice keyboard navigation starts at the first result and stays in bounds', () => {
assert.equal(moveSearchChoiceIndex(-1, 1, 3), 0);
assert.equal(moveSearchChoiceIndex(-1, -1, 3), 2);
assert.equal(moveSearchChoiceIndex(0, -1, 3), 0);
@@ -77,7 +77,7 @@ test('searchable choice keyboard navigation starts at the first result and stays
assert.equal(moveSearchChoiceIndex(0, -1, -1), -1);
});
test('anonymous arithmetic journey skips formal investor and project sections', () => {
void test('anonymous arithmetic journey skips formal investor and project sections', () => {
assert.deepEqual(
getSimulationSections({ purpose: 'simulate_only' }).map(
(section) => section.id,
@@ -90,7 +90,7 @@ test('anonymous arithmetic journey skips formal investor and project sections',
);
});
test('small business exploratory draft includes idea and finance without mandatory formal project data', () => {
void test('small business exploratory draft includes idea and finance without mandatory formal project data', () => {
const draft = {
journey_type: 'small_business',
purpose: 'simulate_only',
@@ -98,35 +98,39 @@ test('small business exploratory draft includes idea and finance without mandato
};
assert.deepEqual(
getSimulationSections(draft).map((section) => section.id),
[
'purpose',
'market',
'location',
'team',
'financial',
'review',
],
['purpose', 'market', 'location', 'team', 'financial', 'review'],
);
assert.deepEqual(validateSimulationDraft(draft, 'market'), {});
const ideaFields = [...simulationFieldGroups.project, ...simulationFieldGroups.market].filter((field) =>
field.showWhen?.(draft),
).filter((field, index, all) => all.findIndex((candidate) => candidate.key === field.key) === index);
const ideaFields = [
...simulationFieldGroups.project,
...simulationFieldGroups.market,
]
.filter((field) => field.showWhen?.(draft))
.filter(
(field, index, all) =>
all.findIndex((candidate) => candidate.key === field.key) ===
index,
);
for (const key of [
'project_title',
'project_summary',
'project_problem',
'target_customers',
'value_proposition',
'market_assumption',
'market_source',
'project_type',
'sector_id',
'activity_id',
'products_services',
'maturity_stage',
'expected_start_date',
'project_duration_years',
]) assert.ok(ideaFields.some((field) => field.key === key), `missing ${key}`);
'project_title',
'project_summary',
'project_problem',
'target_customers',
'value_proposition',
'market_assumption',
'market_source',
'project_type',
'sector_id',
'activity_id',
'products_services',
'maturity_stage',
'expected_start_date',
'project_duration_years',
])
assert.ok(
ideaFields.some((field) => field.key === key),
`missing ${key}`,
);
assert.equal(
ideaFields.some((field) =>
typeof field.required === 'function'
@@ -145,26 +149,54 @@ test('small business exploratory draft includes idea and finance without mandato
assert.deepEqual(validateSimulationDraft(draft, 'opportunity'), {});
});
test('project investment evaluation opens a direct project, location, finance, tax and analysis journey', () => {
void test('project investment evaluation opens a direct project, location, finance, tax and analysis journey', () => {
const selected = replaceSimulationValue({}, 'journey_type', 'investor');
assert.equal(selected.purpose, 'simulate_only');
const sections = getSimulationSections(selected).map((section) => section.id);
const sections = getSimulationSections(selected).map(
(section) => section.id,
);
assert.deepEqual(sections, [
'purpose', 'project', 'location', 'financial', 'tax', 'scenarios', 'procedures', 'review',
'purpose',
'project',
'location',
'financial',
'tax',
'scenarios',
'procedures',
'review',
]);
for (const sectionId of ['project', 'location', 'financial', 'tax', 'procedures']) {
for (const sectionId of [
'project',
'location',
'financial',
'tax',
'procedures',
]) {
assert.deepEqual(validateSimulationDraft(selected, sectionId), {});
}
const fieldsVisible = (group) => simulationFieldGroups[group].filter((field) => field.showWhen?.(selected) ?? true);
assert.ok(fieldsVisible('project').some((field) => field.key === 'activity_id'));
assert.ok(fieldsVisible('location').some((field) => field.key === 'infrastructure_needs'));
assert.ok(fieldsVisible('financial').some((field) => field.key === 'total_investment'));
const fieldsVisible = (group) =>
simulationFieldGroups[group].filter(
(field) => field.showWhen?.(selected) ?? true,
);
assert.ok(
fieldsVisible('project').some((field) => field.key === 'activity_id'),
);
assert.ok(
fieldsVisible('location').some(
(field) => field.key === 'infrastructure_needs',
),
);
assert.ok(
fieldsVisible('financial').some(
(field) => field.key === 'total_investment',
),
);
assert.equal(simulationFieldGroups.procedures[0].showWhen(selected), true);
assert.ok(simulationOptions.infrastructure.includes('raw_materials'));
assert.ok(simulationOptions.infrastructure.includes('legal_requirements'));
});
test('public journeys offer distinct section paths for personal, small business, company, and investor', () => {
void test('public journeys offer distinct section paths for personal, small business, company, and investor', () => {
assert.deepEqual(
getSimulationSections({
journey_type: 'personal',
@@ -214,7 +246,7 @@ test('public journeys offer distinct section paths for personal, small business,
assert.equal(advancedSimulationFields.has('deductible_costs'), true);
});
test('switching to anonymous mode keeps non-sensitive journey and detail choices', () => {
void test('switching to anonymous mode keeps non-sensitive journey and detail choices', () => {
assert.deepEqual(
replaceSimulationValue(
{
@@ -237,7 +269,7 @@ test('switching to anonymous mode keeps non-sensitive journey and detail choices
);
});
test('changing territorial or sector parents clears every dependent value', () => {
void test('changing territorial or sector parents clears every dependent value', () => {
assert.deepEqual(
replaceSimulationValue(
{
@@ -261,7 +293,7 @@ test('changing territorial or sector parents clears every dependent value', () =
);
});
test('changing the purpose preserves private and project answers for later correction', () => {
void test('changing the purpose preserves private and project answers for later correction', () => {
const next = replaceSimulationValue(
{
purpose: 'own_investment',
@@ -284,7 +316,7 @@ test('changing the purpose preserves private and project answers for later corre
});
});
test('approved-parameter fiscal mode does not ask users to enter a rate', () => {
void test('approved-parameter fiscal mode does not ask users to enter a rate', () => {
const base = {
purpose: 'simulate_only',
fiscal_period: '2026',
@@ -300,7 +332,7 @@ test('approved-parameter fiscal mode does not ask users to enter a rate', () =>
assert.deepEqual(validateSimulationDraft(base, 'tax'), {});
});
test('custom planning mode requires user assumptions and validates percentage limits', () => {
void test('custom planning mode requires user assumptions and validates percentage limits', () => {
const base = {
purpose: 'simulate_only',
fiscal_period: '2026',
@@ -339,7 +371,7 @@ test('custom planning mode requires user assumptions and validates percentage li
);
});
test('fiscal intake asks only component-specific questions and leaves residence unresolved when unknown', () => {
void test('fiscal intake asks only component-specific questions and leaves residence unresolved when unknown', () => {
assert.equal(
simulationOptions.fiscal_period.includes(
String(new Date().getFullYear() + 1),
@@ -416,7 +448,7 @@ test('fiscal intake asks only component-specific questions and leaves residence
);
});
test('financial reconciliation reports a mismatch without inventing a fiscal value', () => {
void test('financial reconciliation reports a mismatch without inventing a fiscal value', () => {
const errors = validateSimulationDraft(
{
currency: 'USD',
@@ -435,7 +467,7 @@ test('financial reconciliation reports a mismatch without inventing a fiscal val
);
});
test('autosave omits identity and contact fields from browser storage', () => {
void test('autosave omits identity and contact fields from browser storage', () => {
assert.deepEqual(
getAutosaveSnapshot({
total_investment: '50',
@@ -449,7 +481,7 @@ test('autosave omits identity and contact fields from browser storage', () => {
);
});
test('server draft snapshots split private identity from economic values', () => {
void test('server draft snapshots split private identity from economic values', () => {
assert.deepEqual(
partitionSimulationDraft({
journey_type: 'personal',
@@ -518,7 +550,7 @@ test('server draft snapshots split private identity from economic values', () =>
);
});
test('anonymous server snapshots omit personal values and labels before transmission', () => {
void test('anonymous server snapshots omit personal values and labels before transmission', () => {
assert.deepEqual(
partitionSimulationDraft(
{
@@ -544,7 +576,7 @@ test('anonymous server snapshots omit personal values and labels before transmis
);
});
test('server-owned converted simulation snapshots are restored separately from editable form fields', () => {
void test('server-owned converted simulation snapshots are restored separately from editable form fields', () => {
const restored = restoreSimulationDraft(
{
purpose: 'own_investment',
@@ -562,7 +594,7 @@ test('server-owned converted simulation snapshots are restored separately from e
);
});
test('completed arithmetic CSV preserves calculation details without exporting personal data', () => {
void test('completed arithmetic CSV preserves calculation details without exporting personal data', () => {
const simulation = {
id: '12345678-aaaa-bbbb-cccc-123456789abc',
status: 'completed',
@@ -649,7 +681,7 @@ test('completed arithmetic CSV preserves calculation details without exporting p
);
});
test('versioned arithmetic report reference requires the exact current snapshot and a valid hash', () => {
void test('versioned arithmetic report reference requires the exact current snapshot and a valid hash', () => {
const snapshot = {
contract_version: 1,
context: { scenario_version: 4 },
@@ -696,7 +728,7 @@ test('versioned arithmetic report reference requires the exact current snapshot
);
});
test('versioned arithmetic CSV refuses a result envelope that differs from the legacy total', () => {
void test('versioned arithmetic CSV refuses a result envelope that differs from the legacy total', () => {
assert.throws(
() =>
exportCompletedArithmeticCsv({
@@ -727,7 +759,7 @@ test('versioned arithmetic CSV refuses a result envelope that differs from the l
);
});
test('versioned arithmetic CSV refuses a report from another scenario revision', () => {
void test('versioned arithmetic CSV refuses a report from another scenario revision', () => {
const snapshot = {
indicative_total: '10.00',
legal_interpretation: false,
@@ -769,7 +801,7 @@ test('versioned arithmetic CSV refuses a report from another scenario revision',
);
});
test('arithmetic result reader exposes only reconciled versioned or legacy values', () => {
void test('arithmetic result reader exposes only reconciled versioned or legacy values', () => {
const snapshot = {
indicative_total: '0.20',
legal_interpretation: false,
@@ -812,7 +844,7 @@ test('arithmetic result reader exposes only reconciled versioned or legacy value
);
});
test('arithmetic result CSV neutralizes formula-like report metadata', () => {
void test('arithmetic result CSV neutralizes formula-like report metadata', () => {
const csv = exportCompletedArithmeticCsv({
id: '=HYPERLINK("https://example.invalid")',
status: 'completed',