From 5e17c25575a159c885208c26ce3a7eaf4adabcae Mon Sep 17 00:00:00 2001 From: Guide Fari Date: Sat, 11 Jul 2026 01:14:42 +0200 Subject: [PATCH] test(vps): strengthen the music-artists fallback parity check The step 2a test only checked Array.isArray(body) for /api/music/artists via the new handler -- it would pass even if the fallback silently returned an empty array or a different shape than Hono's real response. Replaced with a real parity check: request the same path through both webHandler.handler() and the known-good app.request(), assert identical status and body. This is what the test file's stated purpose (behavioral parity with the Hono app) actually requires. --- apps/vps/src/http/routes.blackbox.test.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/vps/src/http/routes.blackbox.test.ts b/apps/vps/src/http/routes.blackbox.test.ts index 5dcf82e0..51635d5d 100644 --- a/apps/vps/src/http/routes.blackbox.test.ts +++ b/apps/vps/src/http/routes.blackbox.test.ts @@ -37,12 +37,14 @@ describe('Effect toWebHandler fallback', () => { }) }) - it('GET /api/music/artists falls through to the Hono app', async () => { - const res = await webHandler.handler(new Request('http://localhost/api/music/artists')) + it('GET /api/music/artists returns the same response as the plain Hono app', async () => { + const [viaHandler, viaHono] = await Promise.all([ + webHandler.handler(new Request('http://localhost/api/music/artists')), + app.request('/api/music/artists') + ]) - expect(res.status).toBe(200) - const body: unknown = await res.json() - expect(Array.isArray(body)).toBe(true) + expect(viaHandler.status).toBe(viaHono.status) + await expect(viaHandler.json()).resolves.toEqual(await viaHono.json()) }) it('unknown routes fall through to the Hono app and 404', async () => {