@@ -97,6 +97,14 @@ describe('createHonoApp', () => {
9797 expect ( mockDispatcher . getDiscoveryInfo ) . toHaveBeenCalledWith ( '/api' ) ;
9898 } ) ;
9999
100+ it ( 'GET /api/discovery returns discovery info with correct prefix' , async ( ) => {
101+ const res = await app . request ( '/api/discovery' ) ;
102+ expect ( res . status ) . toBe ( 200 ) ;
103+ const json = await res . json ( ) ;
104+ expect ( json . data ) . toBeDefined ( ) ;
105+ expect ( mockDispatcher . getDiscoveryInfo ) . toHaveBeenCalledWith ( '/api' ) ;
106+ } ) ;
107+
100108 it ( 'uses custom prefix for discovery' , async ( ) => {
101109 const customApp = createHonoApp ( { kernel : mockKernel , prefix : '/v2' } ) ;
102110 const res = await customApp . request ( '/v2' ) ;
@@ -105,6 +113,15 @@ describe('createHonoApp', () => {
105113 expect ( json . data ) . toBeDefined ( ) ;
106114 expect ( mockDispatcher . getDiscoveryInfo ) . toHaveBeenCalledWith ( '/v2' ) ;
107115 } ) ;
116+
117+ it ( 'uses custom prefix for /discovery route' , async ( ) => {
118+ const customApp = createHonoApp ( { kernel : mockKernel , prefix : '/v2' } ) ;
119+ const res = await customApp . request ( '/v2/discovery' ) ;
120+ expect ( res . status ) . toBe ( 200 ) ;
121+ const json = await res . json ( ) ;
122+ expect ( json . data ) . toBeDefined ( ) ;
123+ expect ( mockDispatcher . getDiscoveryInfo ) . toHaveBeenCalledWith ( '/v2' ) ;
124+ } ) ;
108125 } ) ;
109126
110127 describe ( '.well-known Endpoint' , ( ) => {
@@ -277,6 +294,7 @@ describe('createHonoApp', () => {
277294 undefined ,
278295 expect . any ( Object ) ,
279296 expect . objectContaining ( { request : expect . anything ( ) } ) ,
297+ '/api' ,
280298 ) ;
281299 } ) ;
282300
@@ -294,6 +312,7 @@ describe('createHonoApp', () => {
294312 body ,
295313 expect . any ( Object ) ,
296314 expect . objectContaining ( { request : expect . anything ( ) } ) ,
315+ '/api' ,
297316 ) ;
298317 } ) ;
299318
@@ -306,6 +325,7 @@ describe('createHonoApp', () => {
306325 undefined ,
307326 expect . any ( Object ) ,
308327 expect . objectContaining ( { request : expect . anything ( ) } ) ,
328+ '/api' ,
309329 ) ;
310330 } ) ;
311331
@@ -318,6 +338,7 @@ describe('createHonoApp', () => {
318338 undefined ,
319339 expect . objectContaining ( { package : 'com.acme.crm' } ) ,
320340 expect . objectContaining ( { request : expect . anything ( ) } ) ,
341+ '/api' ,
321342 ) ;
322343 } ) ;
323344
@@ -330,6 +351,7 @@ describe('createHonoApp', () => {
330351 undefined ,
331352 expect . any ( Object ) ,
332353 expect . objectContaining ( { request : expect . anything ( ) } ) ,
354+ '/api' ,
333355 ) ;
334356 } ) ;
335357
@@ -347,6 +369,7 @@ describe('createHonoApp', () => {
347369 body ,
348370 expect . any ( Object ) ,
349371 expect . objectContaining ( { request : expect . anything ( ) } ) ,
372+ '/api' ,
350373 ) ;
351374 } ) ;
352375
@@ -364,6 +387,7 @@ describe('createHonoApp', () => {
364387 body ,
365388 expect . any ( Object ) ,
366389 expect . objectContaining ( { request : expect . anything ( ) } ) ,
390+ '/api' ,
367391 ) ;
368392 } ) ;
369393
@@ -384,6 +408,7 @@ describe('createHonoApp', () => {
384408 undefined ,
385409 expect . any ( Object ) ,
386410 expect . objectContaining ( { request : expect . anything ( ) } ) ,
411+ '/api' ,
387412 ) ;
388413 } ) ;
389414
@@ -396,6 +421,7 @@ describe('createHonoApp', () => {
396421 undefined ,
397422 expect . any ( Object ) ,
398423 expect . objectContaining ( { request : expect . anything ( ) } ) ,
424+ '/api' ,
399425 ) ;
400426 } ) ;
401427
@@ -413,6 +439,7 @@ describe('createHonoApp', () => {
413439 body ,
414440 expect . any ( Object ) ,
415441 expect . objectContaining ( { request : expect . anything ( ) } ) ,
442+ '/api' ,
416443 ) ;
417444 } ) ;
418445
@@ -425,6 +452,7 @@ describe('createHonoApp', () => {
425452 undefined ,
426453 expect . objectContaining ( { status : 'active' } ) ,
427454 expect . objectContaining ( { request : expect . anything ( ) } ) ,
455+ '/api' ,
428456 ) ;
429457 } ) ;
430458
@@ -446,6 +474,7 @@ describe('createHonoApp', () => {
446474 undefined ,
447475 expect . any ( Object ) ,
448476 expect . objectContaining ( { request : expect . anything ( ) } ) ,
477+ '/api' ,
449478 ) ;
450479 } ) ;
451480
@@ -458,6 +487,7 @@ describe('createHonoApp', () => {
458487 undefined ,
459488 expect . any ( Object ) ,
460489 expect . objectContaining ( { request : expect . anything ( ) } ) ,
490+ '/api' ,
461491 ) ;
462492 } ) ;
463493
@@ -470,6 +500,7 @@ describe('createHonoApp', () => {
470500 undefined ,
471501 expect . any ( Object ) ,
472502 expect . objectContaining ( { request : expect . anything ( ) } ) ,
503+ '/api' ,
473504 ) ;
474505 } ) ;
475506
@@ -482,6 +513,7 @@ describe('createHonoApp', () => {
482513 undefined ,
483514 expect . any ( Object ) ,
484515 expect . objectContaining ( { request : expect . anything ( ) } ) ,
516+ '/api' ,
485517 ) ;
486518 } ) ;
487519 } ) ;
@@ -571,6 +603,7 @@ describe('createHonoApp', () => {
571603 undefined ,
572604 expect . any ( Object ) ,
573605 expect . objectContaining ( { request : expect . anything ( ) } ) ,
606+ '/api/v1' ,
574607 ) ;
575608 } ) ;
576609
@@ -585,6 +618,7 @@ describe('createHonoApp', () => {
585618 undefined ,
586619 expect . any ( Object ) ,
587620 expect . objectContaining ( { request : expect . anything ( ) } ) ,
621+ '/api/v1' ,
588622 ) ;
589623 } ) ;
590624
@@ -598,6 +632,16 @@ describe('createHonoApp', () => {
598632 expect ( mockDispatcher . getDiscoveryInfo ) . toHaveBeenCalledWith ( '/api/v1' ) ;
599633 } ) ;
600634
635+ it ( 'routes /api/v1/discovery through outer→inner delegation with correct prefix' , async ( ) => {
636+ const outerApp = createVercelApp ( ) ;
637+
638+ const res = await outerApp . request ( '/api/v1/discovery' ) ;
639+ expect ( res . status ) . toBe ( 200 ) ;
640+ const json = await res . json ( ) ;
641+ expect ( json . data ) . toBeDefined ( ) ;
642+ expect ( mockDispatcher . getDiscoveryInfo ) . toHaveBeenCalledWith ( '/api/v1' ) ;
643+ } ) ;
644+
601645 it ( 'routes /api/v1/data/account through outer→inner delegation' , async ( ) => {
602646 const outerApp = createVercelApp ( ) ;
603647
@@ -609,6 +653,7 @@ describe('createHonoApp', () => {
609653 undefined ,
610654 expect . any ( Object ) ,
611655 expect . objectContaining ( { request : expect . anything ( ) } ) ,
656+ '/api/v1' ,
612657 ) ;
613658 } ) ;
614659
0 commit comments