import { describe, expect, it } from 'vitest' import { extractRouteRules } from '../src/pages/route-rules' describe('route-rules', () => { it('should extract route rules from pages', () => { for (const [path, code] of Object.entries(examples)) { const result = extractRouteRules(code, path) expect(result).toStrictEqual({ 'prerender': true, }) } }) }) const examples = { // vue component with two script blocks 'app.vue': ` `, // vue component with a normal script block, and defineRouteRules ambiently 'component.vue': ` `, // JS component with defineRouteRules within a setup function 'component.ts': ` export default { setup() { defineRouteRules({ prerender: true }) } } `, }