Skip to content

Commit

Permalink
test: add brisk route in list routes test
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Dec 15, 2024
1 parent cf622f0 commit 85e49e7
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/cli_formatters/routes_list.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ async function registerRoutes(app: ApplicationService) {
.get('/articles/:id/:slug?', [() => import('#controllers/articles_controller' as any), 'show'])
.as('articles.show')
.domain('blog.adonisjs.com')

router.on('/blog').redirect('/articles')
}

test.group('Formatters | List routes | toJSON', () => {
Expand Down Expand Up @@ -207,6 +209,17 @@ test.group('Formatters | List routes | toJSON', () => {
},
middleware: ['auth', 'acl', 'signed', 'throttle'],
},
{
handler: {
args: '/articles',
name: 'redirectsToRoute',
type: 'closure',
},
methods: ['GET'],
middleware: [],
name: '',
pattern: '/blog',
},
],
},
{
Expand Down Expand Up @@ -353,6 +366,17 @@ test.group('Formatters | List routes | toJSON', () => {
},
middleware: ['auth', 'acl', 'signed', 'throttle'],
},
{
handler: {
args: '/articles',
name: 'redirectsToRoute',
type: 'closure',
},
methods: ['GET', 'HEAD'],
middleware: [],
name: '',
pattern: '/blog',
},
],
},
{
Expand Down Expand Up @@ -426,6 +450,7 @@ test.group('Formatters | List routes | toJSON', () => {
`GET /contact (contact.create) #controllers/contacts_controller.crea… `,
`GET /users ................................... UsersController.handle auth, canViewUsers, closure`,
`GET /payments ................ #controllers/payments_controller.index auth, acl, and 2 more`,
`GET /blog .............................. redirectsToRoute(/articles) `,
],
},
{
Expand Down Expand Up @@ -508,6 +533,10 @@ test.group('Formatters | List routes | toJSON', () => {
message: `dim(GET)|/payments | cyan(#controllers/payments_controller).cyan(index)|dim(auth, acl, signed, throttle)`,
stream: 'stdout',
},
{
message: `dim(GET)|/blog | cyan(redirectsToRoute)dim((/articles))|dim()`,
stream: 'stdout',
},
])
})
})
Expand Down Expand Up @@ -668,6 +697,17 @@ test.group('Formatters | List routes | filters', () => {
},
middleware: [],
},
{
handler: {
args: '/articles',
name: 'redirectsToRoute',
type: 'closure',
},
methods: ['GET'],
middleware: [],
name: '',
pattern: '/blog',
},
],
},
{
Expand Down

0 comments on commit 85e49e7

Please sign in to comment.