fix(e2e): mock /api/invoices/stats/summary to prevent Invoices page crash #345
Reference in New Issue
Block a user
Delete Branch "fix/gro-816-e2e-invoices"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
/api/invoices/stats/summaryin E2E navigation testbeforeEachuseEffectthat fetches payment stats gets{}from the generic fallback, causingpaymentStats.revenueThisMonthto beundefinedand crashing the Invoices page render beforeAdminLayout(showing "GroomBook") ever mountsTest plan
🤖 Generated with Claude Code
cc @cpfarhood — this fix adds a missing mock for
/api/invoices/stats/summaryin E2E navigation tests. The GRO-609InvoicesPageunconditionally fetches payment stats viauseEffect; without a shaped mock, the generic{}fallback causespaymentStatsto beundefined, crashing the page render beforeAdminLayout(which displays theGroomBookbranding) ever mounts. Other admin pages don't have this problem because they don't make unconditional side-effect fetches.Deployed to groombook-dev
Images:
pr-345URL: https://dev.groombook.farh.net
Ready for UAT validation.
CTO Review: Approved
Reviewed the diff and CI results. This is a correct, minimal fix:
/api/invoices/stats/summary(the endpoint added by GRO-609)/api/invoicesfallback — correct route orderingrevenueThisMonth,outstanding,refundsThisMonth,methodBreakdown) matches the payment stats contractMerge blocker: Cannot submit GitHub approval because this PR was authored under the CTO GitHub App identity (
the-dogfather-cto). Need a second approving review from a write-access collaborator to satisfy branch protection (2 required).@cpfarhood — could you provide the second approval so we can merge? QA has already approved. cc @cpfarhood
@cpfarhood — the CTO has approved this PR but as the author cannot count as the second reviewer for branch protection. Your approval is needed to unblock the merge. The fix adds a missing mock for
/api/invoices/stats/summaryso the E2E test no longer crashes before AdminLayout mounts.CTO Review: Approved ✓
Code review complete. The fix is correct:
/api/invoices/stats/summaryendpoint (from GRO-609) was missing a mock in the E2EbeforeEachroute handler/api/invoicescatch-allrevenueThisMonth,outstanding,refundsThisMonth,methodBreakdown) matches the API contractMerge blocker: This PR was created under my GitHub App identity (
app/the-dogfather-cto), so I cannot submit a GitHub review on my own PR. Branch protection requires 2 approvals. QA (Lint Roller) has approved. @cpfarhood — could you add the second approval so we can merge? I've completed my technical review above.cc @cpfarhood