mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-19 23:21:09 +00:00
test: simplify test slightly
This commit is contained in:
parent
f1e3e5e269
commit
79a58e2a78
@ -966,8 +966,8 @@ describe('extends support', () => {
|
||||
expect(html).toContain('Middleware | override: Injected by extended middleware from bar')
|
||||
})
|
||||
it('global middlewares sorting', async () => {
|
||||
const html = await $fetch('/global-middlewares-sorting')
|
||||
expect(html).toContain('Global Middlewares Sorting')
|
||||
const html = await $fetch('/middleware/ordering')
|
||||
expect(html).toContain('catchall at middleware')
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
export default defineNuxtRouteMiddleware((to) => {
|
||||
to.meta.globalMiddleware = to.meta.globalMiddleware || []
|
||||
to.meta.globalMiddleware.push('01.a.global')
|
||||
})
|
@ -1,4 +1,3 @@
|
||||
export default defineNuxtRouteMiddleware((to) => {
|
||||
to.meta.globalMiddleware = to.meta.globalMiddleware || []
|
||||
to.meta.globalMiddleware.push('a.global')
|
||||
useNuxtApp().extendsMiddleware = true
|
||||
})
|
||||
|
@ -1,4 +0,0 @@
|
||||
export default defineNuxtRouteMiddleware((to) => {
|
||||
to.meta.globalMiddleware = to.meta.globalMiddleware || []
|
||||
to.meta.globalMiddleware.push('01.b.global')
|
||||
})
|
5
test/fixtures/basic/middleware/b.global.ts
vendored
5
test/fixtures/basic/middleware/b.global.ts
vendored
@ -1,4 +1,5 @@
|
||||
export default defineNuxtRouteMiddleware((to) => {
|
||||
to.meta.globalMiddleware = to.meta.globalMiddleware || []
|
||||
to.meta.globalMiddleware.push('b.global')
|
||||
if (to.path === '/middleware/ordering' && !useNuxtApp().extendsMiddleware) {
|
||||
return createError('extendsMiddleware not set in layer')
|
||||
}
|
||||
})
|
||||
|
6
test/fixtures/basic/nuxt.config.ts
vendored
6
test/fixtures/basic/nuxt.config.ts
vendored
@ -10,12 +10,6 @@ declare module 'nitropack' {
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'vue-router' {
|
||||
interface RouteMeta {
|
||||
globalMiddleware?: string[]
|
||||
}
|
||||
}
|
||||
|
||||
export default defineNuxtConfig({
|
||||
app: {
|
||||
pageTransition: true,
|
||||
|
Loading…
Reference in New Issue
Block a user