16 lines
700 B
Python
16 lines
700 B
Python
|
|
from fin_hub.services.alerts import evaluate_budget_alerts
|
||
|
|
from fin_hub.services.runway import compute_runway
|
||
|
|
|
||
|
|
|
||
|
|
def test_compute_runway_below_threshold():
|
||
|
|
runway = compute_runway(current_balance=6000, monthly_burns=[2000, 2200, 2100], alert_threshold_months=3.0)
|
||
|
|
assert runway.months_remaining < 3.0
|
||
|
|
assert runway.below_threshold is True
|
||
|
|
|
||
|
|
|
||
|
|
def test_budget_alerts_include_runway_and_utilisation():
|
||
|
|
runway = compute_runway(current_balance=6000, monthly_burns=[2000, 2200, 2100])
|
||
|
|
alerts = evaluate_budget_alerts(runway=runway, allocated=10000, spent=8500)
|
||
|
|
codes = {alert.code for alert in alerts}
|
||
|
|
assert "runway_below_threshold" in codes
|
||
|
|
assert "budget_pressure" in codes
|