From 85e49e72d9ff8d3708339f8353b66e9cdb05b6fb Mon Sep 17 00:00:00 2001 From: Harminder Virk Date: Sun, 15 Dec 2024 08:34:14 +0530 Subject: [PATCH] test: add brisk route in list routes test --- tests/cli_formatters/routes_list.spec.ts | 40 ++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/cli_formatters/routes_list.spec.ts b/tests/cli_formatters/routes_list.spec.ts index b425113c..06359b27 100644 --- a/tests/cli_formatters/routes_list.spec.ts +++ b/tests/cli_formatters/routes_list.spec.ts @@ -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', () => { @@ -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', + }, ], }, { @@ -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', + }, ], }, { @@ -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) `, ], }, { @@ -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', + }, ]) }) }) @@ -668,6 +697,17 @@ test.group('Formatters | List routes | filters', () => { }, middleware: [], }, + { + handler: { + args: '/articles', + name: 'redirectsToRoute', + type: 'closure', + }, + methods: ['GET'], + middleware: [], + name: '', + pattern: '/blog', + }, ], }, {