File size: 1,406 Bytes
20807a3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]


def read(path: str) -> str:
    return (ROOT / path).read_text(encoding="utf-8")


def test_billing_panel_is_actionable_compute_checklist():
    html = read("web/index.html")
    css = read("web/static/app.css")
    billing = html.split('id="billingPanel"', 1)[1].split('</section>', 1)[0]
    for text in [
        "Payment readiness",
        "Pi assistant",
        "Build Job",
        "Generated Space",
        "Guardrail",
        "Inference Providers",
        "A100/H200",
        "Review spend and quotas",
    ]:
        assert text in billing
    assert "billing-compute-checklist" in css
    assert "billing-ready-card" in css


def test_timeline_does_not_auto_scroll_on_identical_signature_after_user_scroll():
    js = read("web/static/progress.js")
    assert "root.dataset.signature===signature" in js
    assert "root.dataset.userScrolled!=='1'" in js
    assert "previousKey!==currentKey" in js
    assert "root.dataset.currentStep=currentKey" in js


def test_event_bindings_are_delegated_and_one_shot():
    app = read("web/static/app.js")
    runs = read("web/static/runs.js")
    assert "function bindOnce" in app
    assert "function bindAllOnce" in app
    assert "root.dataset.boundRuns==='true'" in runs
    assert "root.addEventListener('click'" in runs
    assert "root.addEventListener('keydown'" in runs