32 lines
1.5 KiB
JavaScript
32 lines
1.5 KiB
JavaScript
|
|
import assert from 'node:assert/strict'
|
||
|
|
import { readFileSync } from 'node:fs'
|
||
|
|
import test from 'node:test'
|
||
|
|
import { fileURLToPath } from 'node:url'
|
||
|
|
|
||
|
|
const shell = readFileSync(
|
||
|
|
fileURLToPath(new URL('../src/views/AppShellRouteView.vue', import.meta.url)),
|
||
|
|
'utf8'
|
||
|
|
)
|
||
|
|
const router = readFileSync(fileURLToPath(new URL('../src/router/index.js', import.meta.url)), 'utf8')
|
||
|
|
|
||
|
|
test('app shell main route views are eagerly imported', () => {
|
||
|
|
assert.doesNotMatch(shell, /defineAsyncRouteView/)
|
||
|
|
assert.doesNotMatch(shell, /defineAsyncComponent/)
|
||
|
|
assert.doesNotMatch(shell, /loadingComponent:/)
|
||
|
|
assert.doesNotMatch(shell, /\u9875\u9762\u5207\u6362\u4e2d/)
|
||
|
|
assert.doesNotMatch(shell, /floating:\s*true/)
|
||
|
|
assert.doesNotMatch(shell, /blocking:\s*true/)
|
||
|
|
assert.match(shell, /import AuditView from '\.\/AuditView\.vue'/)
|
||
|
|
assert.match(shell, /import DigitalEmployeesView from '\.\/DigitalEmployeesView\.vue'/)
|
||
|
|
assert.match(shell, /import EmployeeManagementView from '\.\/EmployeeManagementView\.vue'/)
|
||
|
|
assert.match(shell, /import DocumentsCenterView from '\.\/DocumentsCenterView\.vue'/)
|
||
|
|
assert.match(shell, /import BudgetCenterView from '\.\/BudgetCenterView\.vue'/)
|
||
|
|
})
|
||
|
|
|
||
|
|
test('top-level app routes are eagerly imported', () => {
|
||
|
|
assert.doesNotMatch(router, /\(\)\s*=>\s*import\(/)
|
||
|
|
assert.match(router, /import AppShellRouteView from '\.\.\/views\/AppShellRouteView\.vue'/)
|
||
|
|
assert.match(router, /import LoginRouteView from '\.\.\/views\/LoginRouteView\.vue'/)
|
||
|
|
assert.match(router, /import SetupRouteView from '\.\.\/views\/SetupRouteView\.vue'/)
|
||
|
|
})
|