import { 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 expectIncludes = (content, expected, label) => { if (!content.includes(expected)) failures.push(`${label} is missing: ${expected}`) } const venueSelect = read('pages/venue-select/index.vue') expectIncludes(venueSelect, '', 'venue-select template') expectIncludes(venueSelect, "import { onLoad } from '@dcloudio/uni-app'", 'venue-select imports') expectIncludes(venueSelect, "import { VENUE_OPTIONS, navigateToVenueHome } from '@/utils/venue'", 'venue-select imports') expectIncludes(venueSelect, "const isSwitchMode = options?.mode === 'switch'", 'venue-select onLoad guard') expectIncludes(venueSelect, 'if (storedVenue && !isSwitchMode) {', 'venue-select stored venue guard') expectIncludes(venueSelect, 'navigateToVenueHome(storedVenue)', 'venue-select stored venue redirect') expectIncludes(venueSelect, 'isReady.value = true', 'venue-select ready flag') const iceProfile = read('pages/ice/profile/index.vue') expectIncludes(iceProfile, "navigateTo('/pages/venue-select/index?mode=switch')", 'ice profile switch entry') const comprehensiveProfile = read('pages/comprehensive/profile/index.vue') expectIncludes(comprehensiveProfile, "url: '/pages/venue-select/index?mode=switch'", 'comprehensive profile switch entry') if (failures.length) { console.error(`Venue startup verification failed with ${failures.length} issue(s):`) for (const failure of failures) console.error(`- ${failure}`) process.exit(1) } console.log('Venue startup verification passed.')