| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parents[1] | |
| def test_version_is_single_source(): | |
| version = (ROOT / "VERSION").read_text(encoding="utf-8").strip() | |
| ui = (ROOT / "ui_server.py").read_text(encoding="utf-8") | |
| html = (ROOT / "app.html").read_text(encoding="utf-8") | |
| assert version == "4.6.15" | |
| assert 'with_name("VERSION")' in ui | |
| assert "__APP_VERSION__" in html | |
| def test_single_frontend_template(): | |
| assert (ROOT / "app.html").exists() | |
| assert not (ROOT / "templates" / "app.html").exists() | |
| ui = (ROOT / "ui_server.py").read_text(encoding="utf-8") | |
| assert 'with_name("app.html")' in ui | |
| assert "templates/app.html" not in ui | |
| def test_hf_space_metadata_is_valid_shape(): | |
| readme = (ROOT / "README.md").read_text(encoding="utf-8") | |
| assert readme.startswith("---\n") | |
| meta_end = readme.find("\n---", 4) | |
| assert meta_end > 0 | |
| meta = readme[4:meta_end] | |
| assert "sdk: docker" in meta | |
| assert "app_port: 7860" in meta | |
| def test_data_health_center_wired(): | |
| ui = (ROOT / "ui_server.py").read_text(encoding="utf-8") | |
| html = (ROOT / "app.html").read_text(encoding="utf-8") | |
| health = (ROOT / "routes" / "data_health.py").read_text(encoding="utf-8") | |
| appjs = (ROOT / "static" / "js" / "app.js").read_text(encoding="utf-8") | |
| assert '@app.get("/api/sidebar/data-health")' in health | |
| assert 'data-view="dataHealth"' in html | |
| assert 'renderDataHealth' in appjs | |
| health = (ROOT / "routes" / "data_health.py").read_text(encoding="utf-8") | |
| assert '40% metadata completeness + 35% evidence confidence + 25% repository hygiene' in health | |