mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 04:32:42 +00:00
The two failing cases in tests/integration/coach-prefs.test.ts were invoking the route's GET handler with zero arguments — `(GET as () => Promise<Response>)()`. The apiHandler wrapper at src/lib/api-handler.ts:46-47 reads args[0].url to build the Wide Event `http.path`, so the call threw `TypeError: Cannot read properties of undefined (reading 'url')` before the route body ever ran. Other integration tests already pass a real Request to GET (see analytics-health-score, chart-overlay-prefs); aligning this test to the same pattern restores parity with production where Next.js always invokes route handlers with a Request. The api-handler wrapper itself was left untouched — defending against a caller passing undefined would mask the same bug in any future test.