Repository navigation
test(recommendations): assert action-box financial range (closes #281) - #799
Conversation
The production code in `recommendations.ts:3015-3023` already renders the action-box summary as a min/max range via `formatSavingsRange(min, max)`, which collapses to a single value when min == max. This PR adds the regression tests that pin that behaviour for two cases the previous test suite did not cover: - Multi-cell selection with a per-cell range: 2 cells, one with two term variants (1yr/3yr), one single-variant. Asserts the summary shows `$300 - $500/mo`, `$1,100 - $1,800 upfront`, `2 cells`. - Multi-cell selection with identical totals: collapses to `$400/mo` without a range separator (per formatSavingsRange's same-value branch). Closes #281. No production changes -- the range render already shipped via the broader pageLevelRange + formatSavingsRange work; this PR just stops that contract from regressing silently.
|
Warning Review limit reached
More reviews will be available in 29 minutes and 40 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
|
@coderabbitai review |
Rate Limit Exceeded
|
|
@coderabbitai full review Generated by Claude Code |
|
🧠 Learnings used✅ Action performedFull review finished. |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
Summary
Adds two regression tests in
frontend/src/__tests__/recommendations.test.tsthat pin the action-box summary's min/max range behaviour:$300 - $500/mo,$1,100 - $1,800 upfront,2 cells.formatSavingsRangereturns a single value without the–separator. Asserts$400/moand no– $400substring.Why no production change
The action-box render at
frontend/src/recommendations.ts:3015-3023already usesformatSavingsRange(min, max), which is exactly what the issue asks for. The "shows a single value instead of a range" symptom in the issue body predated the broaderpageLevelRange + formatSavingsRangework that landed via the multi-cell-selection refactor. This PR just adds the missing test coverage so the range contract can't regress silently.Locale note
formatCurrencycallstoLocaleString(undefined, ...)which in Node/JSDOM may emit$1100(no thousands separator) instead of$1,100. The regex makes the comma optional to stay robust across runtimes.Test plan
npx jest src/__tests__/recommendations.test.ts -t '#281'— both new tests passnpx jest src/__tests__/recommendations.test.tsno regressionsCloses #281