generated from coulomb/repo-seed
Add Economic Observatory web UI with ledger-backed API
Introduce ui/ dashboard (dark observatory layout), JSON API, and local dev server. All metrics load from expense and payment record ledgers. Links Claude design reference for visual alignment.
This commit is contained in:
25
projects/coulomb-pricing/tests/test_api.py
Normal file
25
projects/coulomb-pricing/tests/test_api.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from decimal import Decimal
|
||||
from pathlib import Path
|
||||
|
||||
from observatory.api import build_dashboard_payload, payload_json
|
||||
|
||||
DATA_DIR = Path(__file__).resolve().parent.parent / "data"
|
||||
|
||||
|
||||
def test_dashboard_payload_contains_live_ledger_totals() -> None:
|
||||
payload = build_dashboard_payload(DATA_DIR, "2026-06")
|
||||
|
||||
assert payload["period"] == "2026-06"
|
||||
assert payload["liquidity"]["remaining_budget"] == "659.12"
|
||||
assert payload["liquidity"]["cumulative_infrastructure_cost"] == "409.28"
|
||||
assert payload["snapshot"]["monthly_infrastructure_cost"] == "29.73"
|
||||
assert len(payload["history"]) == 18
|
||||
assert payload["expense_record_count"] == 58
|
||||
|
||||
|
||||
def test_payload_json_is_valid() -> None:
|
||||
parsed = json.loads(payload_json(DATA_DIR, "2026-06"))
|
||||
assert Decimal(parsed["payments"][0]["fees_amount"]) == Decimal("0.44")
|
||||
Reference in New Issue
Block a user