from pathlib import Path WEB_ROOT = Path(__file__).parents[1] / "src" / "poly_updown" / "web" def test_dashboard_assets_reference_expected_mounts() -> None: html = (WEB_ROOT / "index.html").read_text(encoding="utf-8") assert "/static/styles.css" in html assert "/static/app.js" in html assert "BTC 涨跌实验台" in html assert "当前信号" in html assert 'id="paperPnlTop"' in html assert 'id="btcPrice"' in html assert 'id="upBook"' in html assert 'id="eventLog"' in html assert 'id="analyticsTable"' in html assert 'id="paperTable"' in html def test_dashboard_script_uses_sse_stream() -> None: script = (WEB_ROOT / "app.js").read_text(encoding="utf-8") assert 'new EventSource("/api/stream")' in script assert 'fetch("/api/analytics")' in script assert "renderBook" in script assert "renderEdgeBar" in script