| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parents[1] | |
| def test_billing_panel_visible_copy_is_simple_money_warning(): | |
| html = (ROOT / "web" / "index.html").read_text(encoding="utf-8") | |
| billing = html.split('id="billingPanel"', 1)[1].split('</section>', 1)[0] | |
| visible = billing.split('billing-compat', 1)[0] | |
| assert "This can cost money." in visible | |
| assert "Builds launch Hugging Face Jobs" in visible | |
| assert "Pi uses Hugging Face Inference Providers for Qwen" in visible | |
| assert "Billing dashboard" in visible | |
| assert "Jobs pricing" not in visible | |
| assert "Inference pricing" not in visible | |
| def test_billing_js_only_updates_badge_and_dashboard_link(): | |
| app = (ROOT / "web" / "static" / "app.js").read_text(encoding="utf-8") | |
| fn = app.split("function renderBillingPanel", 1)[1].split("async function loadBillingStatus", 1)[0] | |
| assert "billingStatusBadge" in fn | |
| assert "openBilling" in fn | |
| assert "billingPayment" not in fn | |
| assert "billingNote" not in fn | |