generated from coulomb/repo-seed
28 lines
1.0 KiB
Python
28 lines
1.0 KiB
Python
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
|
|
assert payload["cost_floor"]["active_price"] == "8.99"
|
|
assert len(payload["value_range"]["segments"]) == 2
|
|
assert payload["market_price"]["alternative_count"] == 4
|
|
|
|
|
|
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") |