Files
HealthLog/tests
Marc-André Bombeck 10dd2fc9ad test(coach-prefs): fix NextRequest URL mock — v1.4.22 carryover
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.
2026-05-14 11:36:27 +02:00
..