fix(backend): make 835 summary counts consistent with total_claims

This commit is contained in:
Tyler
2026-06-19 17:07:54 -06:00
parent 8ea951f436
commit 12ac72f915
4 changed files with 47 additions and 8 deletions
+19
View File
@@ -9,6 +9,7 @@ from cyclone.cli import main
FIXTURE = Path(__file__).parent / "fixtures" / "minimal_835.txt"
UNBALANCED = Path(__file__).parent / "fixtures" / "unbalanced_835.txt"
CO_FIXTURE = Path(__file__).parent / "fixtures" / "co_medicaid_835.txt"
def test_cli_parse_835_writes_outputs(tmp_path: Path):
@@ -71,3 +72,21 @@ def test_cli_parse_835_generic_payer(tmp_path: Path):
assert result.exit_code == 0, result.output
summary = json.loads((tmp_path / "summary.json").read_text())
assert summary["passed"] == 1
def test_cli_parse_835_summary_counts_consistent(tmp_path: Path):
"""Regression: passed + failed must equal total_claims for any batch size.
The CO Medicaid fixture has 2 claim payments; if the batch validates
cleanly, both must show as passed (passed=2, failed=0). A pre-fix
implementation set passed=1 regardless of claim count.
"""
runner = CliRunner()
result = runner.invoke(main, ["parse-835", str(CO_FIXTURE), "--output-dir", str(tmp_path)])
assert result.exit_code == 0, result.output
summary = json.loads((tmp_path / "summary.json").read_text())
assert summary["total_claims"] == 2
assert summary["passed"] + summary["failed"] == summary["total_claims"]
assert summary["passed"] == 2
assert summary["failed"] == 0
assert summary["failed_claim_ids"] == []