@@ -202,6 +202,21 @@ describe('Express Routing - TypeScript', () => {
202202 expect ( response . body . status ) . toBe ( 'operational' )
203203 } )
204204
205+ test ( 'should support async grouped routes' , async ( ) => {
206+ await Router . group ( '/api' , async ( ) => {
207+ await new Promise < void > ( resolve => setTimeout ( resolve , 5 ) )
208+ Router . get ( '/async-group' , ( { res } : HttpContext ) => {
209+ res . json ( { grouped : true } )
210+ } )
211+ } )
212+
213+ await setupApp ( )
214+
215+ const response = await request ( app ) . get ( '/api/async-group' )
216+ expect ( response . status ) . toBe ( 200 )
217+ expect ( response . body . grouped ) . toBe ( true )
218+ } )
219+
205220 test ( 'should handle typed error in middleware' , async ( ) => {
206221 const errorMiddleware = (
207222 req : Request ,
@@ -436,6 +451,22 @@ describe('H3 Routing - TypeScript', () => {
436451 expect ( response . status ) . toBe ( 'operational' )
437452 } )
438453
454+ test ( 'should support async grouped routes' , async ( ) => {
455+ await H3Router . group ( '/api' , async ( ) => {
456+ await new Promise < void > ( resolve => setTimeout ( resolve , 5 ) )
457+ H3Router . get ( '/async-group' , ( ) => {
458+ return { grouped : true }
459+ } )
460+ } )
461+
462+ setupApp ( )
463+
464+ const response = await router
465+ . fetch ( new global . Request ( new URL ( 'http://localhost/api/async-group' ) , { method : 'GET' } ) )
466+ . then ( res => res . json ( ) )
467+ expect ( response . grouped ) . toBe ( true )
468+ } )
469+
439470 test ( 'should handle typed error in middleware' , async ( ) => {
440471 const errorMiddleware = ( ) : void => {
441472 throw new HTTPError ( 'Middleware error' , { status : 500 } )
0 commit comments