feat: churn-analysis golden fixtures and deterministic tests - #992
Conversation
…iLioLabs#886) Expand churn-analysis coverage with checked-in golden fixtures under scripts/data/churn-analysis-fixtures.json and a fixture-driven test runner in test-churn-analysis.ts: - 7 fixtures covering cohort retention (new/retention resubscription logic), merchant churn breakdown with single-subscriber filtering, multi-cohort churn projection, grace-period cancelled-with-refund handling, empty/single event edge cases, and single-subscriber merchant exclusion. - Non-zero exit on any assertion failure; add npm test script mapping to npx tsx test-churn-analysis.ts. - Preserve existing SQLite/RPC fallback and report-structure coverage. Tests: npm test (scripts) passes.
dc02493 to
6e47bef
Compare
|
@iexwr Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
Rebased onto the latest Note: |
Summary
Closes #886 — expand the churn-analysis script test suite with checked-in golden fixtures and a fixture-driven runner, so analytics metrics can no longer regress silently.
Changes
scripts/data/churn-analysis-fixtures.json(new): 7 golden fixtures covering:newandretentionresubscription logic (80%+ of the metric surface).cancelled_with_refundtreated identically tocancelled.scripts/test-churn-analysis.ts(rewritten): loads fixtures fromdata/, asserts cohort metrics, merchant breakdown, and projection per fixture per logic; keeps the existing report-structure and SQLite/RPC fallback coverage; exits non-zero on any assertion failure.scripts/package.json: addsnpm test→tsx test-churn-analysis.ts.Validation
Acceptance Criteria
scripts/data/with documented descriptionsprocess.exit(1))