import { existsSync, readFileSync } from 'node:fs' import { fileURLToPath } from 'node:url' import { dirname, resolve } from 'node:path' const root = resolve(dirname(fileURLToPath(import.meta.url)), '..') const srcRoot = resolve(root, 'src') const failures = [] const read = (relativePath) => readFileSync(resolve(srcRoot, relativePath), 'utf8') const expectFile = (relativePath) => { const fullPath = resolve(srcRoot, relativePath) if (!existsSync(fullPath)) failures.push(`Missing file: ${relativePath}`) } const expectIncludes = (content, expected, label) => { if (!content.includes(expected)) failures.push(`${label} is missing: ${expected}`) } expectFile('components/VenueSwitchHeader.vue') if (existsSync(resolve(srcRoot, 'components/VenueSwitchHeader.vue'))) { const component = read('components/VenueSwitchHeader.vue') expectIncludes(component, "uni.navigateTo({ url: '/pages/venue-select/index?mode=switch' })", 'VenueSwitchHeader switch navigation') expectIncludes(component, 'class="venue-switch-header"', 'VenueSwitchHeader layout root') expectIncludes(component, 'class="venue-switch-action"', 'VenueSwitchHeader action') expectIncludes(component, '切换场馆', 'VenueSwitchHeader action text') expectIncludes(component, '', 'VenueSwitchHeader css arrow') } const homePages = [ { file: 'pages/ice/home/index.vue', venue: '冰场馆' }, { file: 'pages/comprehensive/home/index.vue', venue: '综合场馆' } ] for (const { file, venue } of homePages) { const content = read(file) expectIncludes(content, '