fix(e2e): mock reports API with shaped responses in navigation tests #47

Merged
ghost merged 1 commits from fix/e2e-reports-mock into main 2026-03-18 03:26:54 +00:00
ghost commented 2026-03-18 03:21:25 +00:00 (Migrated from github.com)

Problem

Main CI failing — `reports page loads` E2E test crashes the React tree.

The `beforeEach` mock returns `[]` for all API calls. The Reports component destructures shaped responses:

  • `apptData.byPeriod` → `undefined` when `apptData = []`
  • `svcData.rows` → `undefined` when `svcData = []`
  • `summary.revenue.totalCents` → TypeError when `summary = []` (array is truthy so the guard doesn't protect)

The render throws, React unmounts the tree, and "Groom Book" disappears on retries.

Fix

Add specific mocks for the five `/api/reports/*` endpoints in `navigation.spec.ts` returning properly shaped empty responses. All other endpoints continue to return `[]`.

Test plan

  • `reports page loads` should pass — page renders with empty data instead of crashing
  • All other navigation tests unchanged

🤖 Generated with Claude Code

## Problem Main CI failing — \`reports page loads\` E2E test crashes the React tree. The \`beforeEach\` mock returns \`[]\` for all API calls. The Reports component destructures shaped responses: - \`apptData.byPeriod\` → \`undefined\` when \`apptData = []\` - \`svcData.rows\` → \`undefined\` when \`svcData = []\` - \`summary.revenue.totalCents\` → TypeError when \`summary = []\` (array is truthy so the guard doesn't protect) The render throws, React unmounts the tree, and "Groom Book" disappears on retries. ## Fix Add specific mocks for the five \`/api/reports/*\` endpoints in \`navigation.spec.ts\` returning properly shaped empty responses. All other endpoints continue to return \`[]\`. ## Test plan - [x] \`reports page loads\` should pass — page renders with empty data instead of crashing - [x] All other navigation tests unchanged 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This repo is archived. You cannot comment on pull requests.