Skip to content

Commit 85e49e7

Browse files
committed
test: add brisk route in list routes test
1 parent cf622f0 commit 85e49e7

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

tests/cli_formatters/routes_list.spec.ts

+40
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ async function registerRoutes(app: ApplicationService) {
9595
.get('/articles/:id/:slug?', [() => import('#controllers/articles_controller' as any), 'show'])
9696
.as('articles.show')
9797
.domain('blog.adonisjs.com')
98+
99+
router.on('/blog').redirect('/articles')
98100
}
99101

100102
test.group('Formatters | List routes | toJSON', () => {
@@ -207,6 +209,17 @@ test.group('Formatters | List routes | toJSON', () => {
207209
},
208210
middleware: ['auth', 'acl', 'signed', 'throttle'],
209211
},
212+
{
213+
handler: {
214+
args: '/articles',
215+
name: 'redirectsToRoute',
216+
type: 'closure',
217+
},
218+
methods: ['GET'],
219+
middleware: [],
220+
name: '',
221+
pattern: '/blog',
222+
},
210223
],
211224
},
212225
{
@@ -353,6 +366,17 @@ test.group('Formatters | List routes | toJSON', () => {
353366
},
354367
middleware: ['auth', 'acl', 'signed', 'throttle'],
355368
},
369+
{
370+
handler: {
371+
args: '/articles',
372+
name: 'redirectsToRoute',
373+
type: 'closure',
374+
},
375+
methods: ['GET', 'HEAD'],
376+
middleware: [],
377+
name: '',
378+
pattern: '/blog',
379+
},
356380
],
357381
},
358382
{
@@ -426,6 +450,7 @@ test.group('Formatters | List routes | toJSON', () => {
426450
`GET /contact (contact.create) #controllers/contacts_controller.crea… `,
427451
`GET /users ................................... UsersController.handle auth, canViewUsers, closure`,
428452
`GET /payments ................ #controllers/payments_controller.index auth, acl, and 2 more`,
453+
`GET /blog .............................. redirectsToRoute(/articles) `,
429454
],
430455
},
431456
{
@@ -508,6 +533,10 @@ test.group('Formatters | List routes | toJSON', () => {
508533
message: `dim(GET)|/payments | cyan(#controllers/payments_controller).cyan(index)|dim(auth, acl, signed, throttle)`,
509534
stream: 'stdout',
510535
},
536+
{
537+
message: `dim(GET)|/blog | cyan(redirectsToRoute)dim((/articles))|dim()`,
538+
stream: 'stdout',
539+
},
511540
])
512541
})
513542
})
@@ -668,6 +697,17 @@ test.group('Formatters | List routes | filters', () => {
668697
},
669698
middleware: [],
670699
},
700+
{
701+
handler: {
702+
args: '/articles',
703+
name: 'redirectsToRoute',
704+
type: 'closure',
705+
},
706+
methods: ['GET'],
707+
middleware: [],
708+
name: '',
709+
pattern: '/blog',
710+
},
671711
],
672712
},
673713
{

0 commit comments

Comments
 (0)