mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 07:05:11 +00:00
test: add type test for appMiddleware route rules
This commit is contained in:
parent
cac7454702
commit
70669012fb
11
test/fixtures/basic-types/types.ts
vendored
11
test/fixtures/basic-types/types.ts
vendored
@ -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>()
|
||||
|
Loading…
Reference in New Issue
Block a user