feat(backend): parse-835 JSON response includes reconciliation summary
This commit is contained in:
@@ -11,6 +11,7 @@ from cyclone.api import app
|
||||
from cyclone.store import store as global_store
|
||||
|
||||
FIXTURE = Path(__file__).parent / "fixtures" / "co_medicaid_837p.txt"
|
||||
FIXTURE_835 = Path(__file__).parent / "fixtures" / "co_medicaid_835.txt"
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
@@ -79,3 +80,26 @@ def test_validation_failed_837_does_not_create_batch(client: TestClient):
|
||||
)
|
||||
assert resp.status_code == 422, resp.text
|
||||
assert len(global_store.list()) == 0
|
||||
|
||||
|
||||
def test_parse_835_response_includes_reconciliation_summary(
|
||||
client: TestClient, tmp_path: Path
|
||||
):
|
||||
"""A successful 835 parse returns matched/unmatched counts in JSON."""
|
||||
fixture = FIXTURE_835.read_text()
|
||||
p = tmp_path / "era.txt"
|
||||
p.write_text(fixture)
|
||||
with open(p, "rb") as f:
|
||||
r = client.post(
|
||||
"/api/parse-835",
|
||||
files={"file": ("era.txt", f, "text/plain")},
|
||||
headers={"Accept": "application/json"},
|
||||
)
|
||||
assert r.status_code == 200
|
||||
body = r.json()
|
||||
assert "reconciliation" in body, f"missing reconciliation: {list(body.keys())}"
|
||||
rec = body["reconciliation"]
|
||||
assert "matched" in rec
|
||||
assert "unmatched_claims" in rec
|
||||
assert "unmatched_remittances" in rec
|
||||
assert "skipped" in rec
|
||||
|
||||
Reference in New Issue
Block a user