whisper-money/tests/Feature
Víctor Falcón 7e958284e3
fix(loans): project monthly balances from actual entries instead of original params (#259)
## Summary

- **Bug**: The `loans:generate-balances` command called
`getBalanceAtDate()` which always recalculated the remaining balance
from the **original loan parameters** (`original_amount`,
`annual_interest_rate`, `loan_term_months`, `start_date`), completely
ignoring existing actual balance entries. When the real balance was
lower than the theoretical amortization schedule (e.g. user made extra
payments), the auto-generated balance would **jump up** instead of
continuing to decrease.
- **Example**: Account `019d0b33-d3c5-7110-9033-51155ac93219` had a real
balance of ~4,489,670 (March 2026), but the command generated 5,700,356
(April 2026) — a jump **up** of ~1.2M cents instead of the expected ~16K
decrease.
- **Fix**: `getBalanceAtDate()` now checks for the latest
`AccountBalance` entry on or before the target date and projects forward
from it, falling back to the theoretical formula only when no entries
exist. This matches the method's own documented behavior and aligns with
how `generateProjection()` already works.

## Testing

Added 4 new tests:
- Projects from existing balance entries instead of original loan params
- Returns existing balance when target date is in the same month
- Generates correct monthly balance when existing entries differ from
theoretical
- All 44 existing loan tests continue to pass
2026-04-04 15:57:29 +01:00
..
Api Remove encryption from bank account names (#104) 2026-02-09 14:15:26 +01:00
Auth fix: Disable email verification on dev/local 2026-02-07 17:52:53 +01:00
Console feat(cashflow): track transfer categories in trends (#236) 2026-03-18 14:02:47 +00:00
Jobs/Drip Add subscription cancellation email with manual trigger command (#47) 2025-12-30 20:32:44 +01:00
Listeners feat(emails): co-founder language, welcome rewrite, and Spanish translations (#208) 2026-03-05 15:22:07 +01:00
Onboarding feat: (Onboarding) add categorization intro screen with benefit cards (#201) 2026-03-05 11:47:12 +01:00
OpenBanking feat(settings): centralize currency options and split profile/account support (#256) 2026-04-02 19:23:10 +02:00
Settings feat(settings): centralize currency options and split profile/account support (#256) 2026-04-02 19:23:10 +02:00
Sync refactor: Simplify transaction endpoints architecture (#76) 2026-01-25 16:15:17 +01:00
AccountBalanceControllerTest.php feat: investment benefits — show gains/losses on investment accounts (#140) 2026-02-23 13:59:10 +01:00
AccountControllerTest.php fix(loans): project monthly balances from actual entries instead of original params (#259) 2026-04-04 15:57:29 +01:00
ApplyRealEstateRevaluationTest.php feat(accounts): add market value and annual revaluation to real estate accounts (#245) 2026-03-26 11:02:20 +01:00
AutomationRuleEvaluationTest.php feat: Apply automation rules to bank-synced transactions (#112) 2026-02-12 14:20:55 +01:00
AutomationRuleTest.php chore: Simplify IndexedDB sync by moving to Inertia shared props (#63) 2026-01-19 19:15:26 +01:00
BackfillAccountIbansCommandTest.php chore: upgrade Laravel 12 to 13 (#242) 2026-03-25 12:56:33 +00:00
BalanceLookupTest.php feat: investment benefits — show gains/losses on investment accounts (#140) 2026-02-23 13:59:10 +01:00
BudgetHistoricalAssignmentTest.php Remove budgets feature flag (#108) 2026-02-12 09:58:01 +01:00
BudgetPeriodDateTest.php Remove budgets feature flag (#108) 2026-02-12 09:58:01 +01:00
BudgetTest.php Fix net worth chart config UX and color scheme issues (#250) 2026-03-31 11:19:35 +01:00
BudgetTransactionServiceTest.php fix(budgets): handle refunds correctly in budget spending calculations (#152) 2026-02-24 21:12:36 +01:00
BulkUpdateTransactionsTest.php refactor: Simplify transaction endpoints architecture (#76) 2026-01-25 16:15:17 +01:00
CashflowAnalyticsTest.php fix(cashflow): net transfer categories in sankey (#257) 2026-04-01 14:48:38 +01:00
CurrencyConversionServiceTest.php feat(settings): centralize currency options and split profile/account support (#256) 2026-04-02 19:23:10 +02:00
DashboardAnalyticsTest.php feat(settings): centralize currency options and split profile/account support (#256) 2026-04-02 19:23:10 +02:00
DashboardTest.php User Onboarding Flow (#23) 2025-12-12 13:06:08 +01:00
DecryptTransactionsTest.php feat: Decrypt encrypted transactions on key unlock (#123) 2026-02-16 10:37:43 +01:00
DeleteUserCommandTest.php test: Optimize tests performance 2026-01-17 19:20:23 +01:00
DemoAccountRestrictionsTest.php test: Optimize DemoAccountRestrictionsTest to run under 10s 2026-01-28 21:27:27 +01:00
EncryptionTest.php User Onboarding Flow (#23) 2025-12-12 13:06:08 +01:00
ExampleTest.php Install Pest 2025-11-07 12:01:58 +00:00
ExchangeRateServiceTest.php feat: Add multi-currency conversion for net worth charts (#138) 2026-02-20 10:45:23 +01:00
IdorVulnerabilityTest.php refactor: Simplify transaction endpoints architecture (#76) 2026-01-25 16:15:17 +01:00
ImportDataTest.php fix: Apply automation rule labels on transaction creation and import (#79) 2026-01-27 11:11:29 +01:00
InertiaSharedDataTest.php feat(settings): centralize currency options and split profile/account support (#256) 2026-04-02 19:23:10 +02:00
LabelTest.php feat: add transaction labels feature (#24) 2025-12-13 13:02:19 +01:00
LoanTest.php fix(loans): project monthly balances from actual entries instead of original params (#259) 2026-04-04 15:57:29 +01:00
LocalizationTest.php feat(i18n): add localization test and fix missing Spanish translations (#174) 2026-03-01 12:32:39 +00:00
PlaintextTransactionsTest.php Remove plaintext-transactions feature flag & E2E references (#116) 2026-02-13 11:10:21 +01:00
PwaTest.php feat: Improve PWA standalone experience and redirect to dashboard (#90) 2026-02-01 11:33:10 +01:00
ReEvaluateTransactionRulesTest.php chore: upgrade Laravel 12 to 13 (#242) 2026-03-25 12:56:33 +00:00
RealEstateFeatureFlagTest.php chore: upgrade Laravel 12 to 13 (#242) 2026-03-25 12:56:33 +00:00
RealEstateTest.php feat(accounts): add loan amortization projections for loan accounts (#246) 2026-03-26 15:06:09 +01:00
ResendSyncCommandTest.php feat: Sync new users to Resend contacts (#85) 2026-01-28 21:25:58 +01:00
SitemapTest.php User Onboarding Flow (#23) 2025-12-12 13:06:08 +01:00
SubscriptionTest.php fix(billing): create Stripe customer before redirecting to billing portal (#206) 2026-03-05 11:58:04 +00:00
SyncBankingConnectionsCommandTest.php chore: Remove account-mapping feature flag (#252) 2026-04-01 12:09:22 +02:00
SyncStripePricesCommandTest.php feat(pricing): dynamic Stripe pricing with locale-aware formatting (#204) 2026-03-05 11:41:59 +00:00
TransactionFilterTest.php Move transaction filtering from client-side to server-side (#126) 2026-02-16 12:49:04 +01:00
TransactionTest.php chore: upgrade Laravel 12 to 13 (#242) 2026-03-25 12:56:33 +00:00
UserLeadTest.php feat(waitlist): waiting list with referral system (#199) 2026-03-04 12:36:47 +01:00
WelcomeBanksOrderingTest.php feat(landing): open-banking feature section with conditional grid layout (#209) 2026-03-07 13:41:25 +00:00