mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
30 lines
737 B
TypeScript
30 lines
737 B
TypeScript
import { vi } from 'vitest'
|
|
import { defineEventHandler } from 'h3'
|
|
|
|
import { registerEndpoint } from '@nuxt/test-utils/runtime'
|
|
|
|
vi.mock('#app/compat/idle-callback', () => ({
|
|
requestIdleCallback: (cb: Function) => cb(),
|
|
cancelIdleCallback: () => {},
|
|
}))
|
|
|
|
const timestamp = Date.now()
|
|
registerEndpoint('/_nuxt/builds/latest.json', defineEventHandler(() => ({
|
|
id: 'override',
|
|
timestamp,
|
|
})))
|
|
registerEndpoint('/_nuxt/builds/meta/override.json', defineEventHandler(() => ({
|
|
id: 'override',
|
|
timestamp,
|
|
matcher: {
|
|
static: {
|
|
'/': null,
|
|
'/pre': null,
|
|
'/pre/test': { redirect: true },
|
|
},
|
|
wildcard: { '/pre': { prerender: true } },
|
|
dynamic: {},
|
|
},
|
|
prerendered: ['/specific-prerendered'],
|
|
})))
|