whisper-money/tests/Feature
Víctor Falcón 9e2a9cadfe
fix(cashflow): only count sign-matching transactions in Sankey category breakdown (#232)
## Problem

When an income category contained both incoming and outgoing
transactions (e.g. an \"Income from Rents\" category that also holds
property-related expense payments), the Sankey endpoint was summing
**all** amounts together and applying `abs()` to the net result.

Real example reported:

| Date | Description | Amount |
|------|-------------|--------|
| Mar 13 | BIZUM sent — Lavadora | -€124.03 |
| Mar 10 | BIZUM received — luz febrero | +€38.04 |
| Mar 9 | Endesa energy payment | -€38.04 |
| Mar 4 | BIZUM received — agua Febrero | +€41.34 |
| Mar 2 | Comunidad de Propietarios | -€105.92 |

- Net: **-€188.61** → `abs()` → **€188.61 shown as income** 
- Correct: sum of positive flows only → **€79.38** 

## Fix

Added a sign filter to `getCategoryBreakdown()` before the `GROUP BY`
aggregation:
- Income categories: `WHERE transactions.amount > 0`
- Expense categories: `WHERE transactions.amount < 0`

This ensures the Sankey shows the **actual gross flow** on each side
rather than a misleading abs-of-net.

## Test

Added a regression test in `CashflowAnalyticsTest` that reproduces the
exact five transactions from the reported scenario and asserts the
Sankey returns `7938` cents (€79.38) instead of the buggy `18861`
(€188.61).
2026-03-17 09:29:36 +00: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 fix(banks:set-logo): add JPEG support test coverage and prompt for missing arguments (#214) 2026-03-07 16:33:54 +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 fix(banking): treat 429 rate limit as transient, skip error status on sync (#224) 2026-03-16 10:59:46 +00:00
Settings fix(settings): restore budgets settings redirect (#228) 2026-03-16 13:04:08 +01: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: prevent account label combobox crash (#230) 2026-03-16 13:03:11 +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 fix(banking): correct backfill-ibans endpoint and handle expired sessions gracefully (#222) 2026-03-12 11:57:54 +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 feat(Budgets): add period navigation and unify period selector UI (#171) 2026-03-01 12:25:01 +00: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): only count sign-matching transactions in Sankey category breakdown (#232) 2026-03-17 09:29:36 +00:00
CurrencyConversionServiceTest.php feat: Add Binance integration (#131) 2026-02-18 15:23:46 +01:00
DashboardAnalyticsTest.php feat: enable invested amount tracking for savings accounts (#142) 2026-02-23 17:19:33 +01: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 SEO landing page 2025-11-25 11:33:11 +01:00
LabelTest.php feat: add transaction labels feature (#24) 2025-12-13 13:02:19 +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 feat(transactions): re-add select all matching filters to bulk actions bar (#169) 2026-03-01 10:27:43 +00: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 perf: make banking syncs incremental on subsequent runs (#141) 2026-02-23 15:10:40 +01: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 fix(categorizer): fetch uncategorized transactions from backend instead of IndexedDB (#165) 2026-02-28 16:30:54 +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