import test from 'node:test' import assert from 'node:assert/strict' import { readFileSync } from 'node:fs' import { fileURLToPath } from 'node:url' import { dirname, resolve } from 'node:path' const currentDir = dirname(fileURLToPath(import.meta.url)) const source = readFileSync(resolve(currentDir, '../src/views/generator/pageTheme/index.vue'), 'utf8') test('page theme admin edits frontend and admin navigation independently', () => { assert.match(source, /label="前台菜单"/) assert.match(source, /v-model="shellForm\.frontendNavigation"/) assert.match(source, /label="后台菜单"/) assert.match(source, /v-model="shellForm\.adminNavigation"/) assert.doesNotMatch(source, /v-model="shellForm\.navigation"/) }) test('page theme admin migrates legacy shared navigation on edit', () => { assert.match(source, /parseShell\(json\)/) assert.match(source, /raw\.frontendNavigation \|\| legacyNavigation/) assert.match(source, /raw\.adminNavigation \|\| legacyNavigation/) assert.match(source, /delete result\.navigation/) assert.match(source, /delete shell\.navigation/) })