Skip to content

Commit

Permalink
test: add type test for appMiddleware route rules
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Mar 16, 2024
1 parent cac7454 commit 7066901
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/fixtures/basic-types/types.ts
Expand Up @@ -107,6 +107,17 @@ describe('middleware', () => {
// @ts-expect-error Invalid middleware
definePageMeta({ middleware: 'nonexistent' })
})
it('types routeRules', () => {
defineNuxtConfig({
routeRules: {
// @ts-expect-error Invalid middleware
'/nonexistent': { appMiddleware: 'nonexistent' },
// @ts-expect-error ignore global middleware
'/global': { appMiddleware: 'global' },
'/named': { appMiddleware: 'named' }
}
})
})
it('handles adding middleware', () => {
addRouteMiddleware('example', (to, from) => {
expectTypeOf(to).toEqualTypeOf<RouteLocationNormalized>()
Expand Down

0 comments on commit 7066901

Please sign in to comment.