feat: Enhance currency handling and validation across scenarios
- Updated form template to prefill currency input with default value and added help text for clarity. - Modified integration tests to assert more descriptive error messages for invalid currency codes. - Introduced new tests for currency normalization and validation in various scenarios, including imports and exports. - Added comprehensive tests for pricing calculations, ensuring defaults are respected and overrides function correctly. - Implemented unit tests for pricing settings repository, ensuring CRUD operations and default settings are handled properly. - Enhanced scenario pricing evaluation tests to validate currency handling and metadata defaults. - Added simulation tests to ensure Monte Carlo runs are accurate and handle various distribution scenarios.
This commit is contained in:
@@ -140,3 +140,22 @@ def test_scenario_import_handles_large_dataset() -> None:
|
||||
|
||||
assert len(result.rows) == 500
|
||||
assert len(result.rows) == 500
|
||||
|
||||
|
||||
def test_scenario_import_rejects_invalid_currency() -> None:
|
||||
csv_content = dedent(
|
||||
"""
|
||||
project_name,name,currency
|
||||
Project A,Scenario Invalid,US
|
||||
"""
|
||||
).strip()
|
||||
stream = BytesIO(csv_content.encode("utf-8"))
|
||||
|
||||
result = load_scenario_imports(stream, "scenarios.csv")
|
||||
|
||||
assert not result.rows
|
||||
assert result.errors
|
||||
error = result.errors[0]
|
||||
assert error.row_number == 2
|
||||
assert error.field == "currency"
|
||||
assert "Invalid currency code" in error.message
|
||||
|
||||
Reference in New Issue
Block a user