fix(e2e): mock /api/invoices/stats/summary to prevent Invoices page crash #345

Merged
the-dogfather-cto[bot] merged 1 commits from fix/gro-816-e2e-invoices into dev 2026-04-20 13:59:11 +00:00

1 Commits

Author SHA1 Message Date
Test User 10ad5e7b04 fix(e2e): mock /api/invoices/stats/summary to prevent useEffect crash on Invoices page
The GRO-609 paymentStats useEffect fetches /api/invoices/stats/summary
on every render. Without a mock, the response {} (from the generic // Appointments,
clients, ... fallback) doesn't contain revenueThisMonth, causing the page
to fail rendering before AdminLayout ever mounts. Other admin pages don't
have this problem because they don't make unconditional side-effect fetches.

E2E tests mock all /api/** calls, so the new endpoint needs its own mock.

cc @cpfarhood
2026-04-19 02:25:12 +00:00