Create smoke_v2.py
Browse files- tests/smoke_v2.py +53 -0
tests/smoke_v2.py
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# tests/smoke_v2.py
|
| 2 |
+
"""Lightweight smoke tests for V2 modules and schema shape."""
|
| 3 |
+
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
|
| 6 |
+
from src import config, billing, modal_templates, styles, store
|
| 7 |
+
from src.paths import cases_dir, exports_dir
|
| 8 |
+
|
| 9 |
+
def test_paths_exist():
|
| 10 |
+
pd = config.paths_dict()
|
| 11 |
+
assert "cases_dir" in pd and "exports_dir" in pd
|
| 12 |
+
cases_dir().mkdir(parents=True, exist_ok=True)
|
| 13 |
+
exports_dir().mkdir(parents=True, exist_ok=True)
|
| 14 |
+
|
| 15 |
+
def test_seed_cases_and_schema():
|
| 16 |
+
created = store.seed_cases(reset=True)
|
| 17 |
+
assert len(created) == 4
|
| 18 |
+
for cid in created:
|
| 19 |
+
case = store.read_case(cid)
|
| 20 |
+
assert case is not None
|
| 21 |
+
for k in ["schema_version", "status", "created_at", "updated_at", "billing", "explainability"]:
|
| 22 |
+
assert k in case, f"missing {k} in {cid}"
|
| 23 |
+
assert case["schema_version"] == config.SCHEMA_VERSION
|
| 24 |
+
assert isinstance(case["explainability"].get("manually_modified"), bool)
|
| 25 |
+
|
| 26 |
+
def test_billing_autosuggest():
|
| 27 |
+
s1 = billing.autosuggest_cpt(minutes=5, spoke=False)
|
| 28 |
+
codes1 = [s.code for s in s1]
|
| 29 |
+
assert "99451" in codes1
|
| 30 |
+
assert any(s.eligible for s in s1), "99451 should be eligible at 5 min (written report)"
|
| 31 |
+
s2 = billing.autosuggest_cpt(minutes=12, spoke=True)
|
| 32 |
+
codes2 = [s.code for s in s2]
|
| 33 |
+
assert "99446" in codes2 and "99447" in codes2, "Discussed pathway should list 99446/99447 etc."
|
| 34 |
+
assert any(s.code == "99447" and s.eligible for s in s2), "12 min should make 99447 eligible"
|
| 35 |
+
|
| 36 |
+
def test_837_builder():
|
| 37 |
+
created = store.seed_cases(reset=True)
|
| 38 |
+
case = store.read_case(created[0])
|
| 39 |
+
assert case is not None
|
| 40 |
+
sug = billing.autosuggest_cpt(minutes=12, spoke=True)
|
| 41 |
+
pick = next(s for s in sug if s.code == "99447")
|
| 42 |
+
claim = billing.build_837_claim(case, pick.code, pick.rate, 12, True, attested=True)
|
| 43 |
+
assert claim["service"]["cpt_code"] == "99447"
|
| 44 |
+
assert claim["attested"] is True
|
| 45 |
+
|
| 46 |
+
def test_export_filename_builder():
|
| 47 |
+
p = config.make_export_path("TEST123", "consult_note.md")
|
| 48 |
+
assert p.name.startswith("EC-TEST123_") and p.name.endswith("_consult_note.md")
|
| 49 |
+
|
| 50 |
+
def test_modal_templates_importable():
|
| 51 |
+
# Ensure callables exist; we don't render in tests
|
| 52 |
+
assert hasattr(modal_templates, "show_consult_note_preview")
|
| 53 |
+
assert hasattr(modal_templates, "show_837_claim_preview")
|