feat: add merged venue navigation
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
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, '<view v-if="isReady" class="venue-select-page">', '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.')
|
||||
@@ -0,0 +1,62 @@
|
||||
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 tabPages = [
|
||||
{ file: 'pages/ice/home/index.vue', venue: 'ice', active: 'home' },
|
||||
{ file: 'pages/ice/courses/index.vue', venue: 'ice', active: 'courses' },
|
||||
{ file: 'pages/ice/bookings/index.vue', venue: 'ice', active: 'bookings' },
|
||||
{ file: 'pages/ice/profile/index.vue', venue: 'ice', active: 'profile' },
|
||||
{ file: 'pages/comprehensive/home/index.vue', venue: 'comprehensive', active: 'home' },
|
||||
{ file: 'pages/comprehensive/courses/index.vue', venue: 'comprehensive', active: 'courses' },
|
||||
{ file: 'pages/comprehensive/bookings/index.vue', venue: 'comprehensive', active: 'bookings' },
|
||||
{ file: 'pages/comprehensive/profile/index.vue', venue: 'comprehensive', active: 'profile' }
|
||||
]
|
||||
|
||||
const icons = ['home', 'course', 'booking', 'mine']
|
||||
const venues = ['ice', 'comprehensive']
|
||||
const failures = []
|
||||
|
||||
const assertFile = (path) => {
|
||||
if (!existsSync(path)) failures.push(`Missing file: ${path}`)
|
||||
}
|
||||
|
||||
assertFile(resolve(srcRoot, 'components/VenueTabBar.vue'))
|
||||
|
||||
for (const { file, venue, active } of tabPages) {
|
||||
const path = resolve(srcRoot, file)
|
||||
assertFile(path)
|
||||
if (!existsSync(path)) continue
|
||||
|
||||
const content = readFileSync(path, 'utf8')
|
||||
if (!content.includes('<VenueTabBar')) {
|
||||
failures.push(`${file} does not render <VenueTabBar>`)
|
||||
}
|
||||
if (!content.includes(`venue="${venue}"`)) {
|
||||
failures.push(`${file} does not pass venue="${venue}"`)
|
||||
}
|
||||
if (!content.includes(`active="${active}"`)) {
|
||||
failures.push(`${file} does not pass active="${active}"`)
|
||||
}
|
||||
if (!content.includes("import VenueTabBar from '@/components/VenueTabBar.vue'")) {
|
||||
failures.push(`${file} does not import VenueTabBar`)
|
||||
}
|
||||
}
|
||||
|
||||
for (const venue of venues) {
|
||||
for (const icon of icons) {
|
||||
assertFile(resolve(srcRoot, `static/${venue}/tab/${icon}.png`))
|
||||
assertFile(resolve(srcRoot, `static/${venue}/tab/${icon}-active.png`))
|
||||
}
|
||||
}
|
||||
|
||||
if (failures.length) {
|
||||
console.error(`Venue tabbar verification failed with ${failures.length} issue(s):`)
|
||||
for (const failure of failures) console.error(`- ${failure}`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
console.log('Venue tabbar verification passed.')
|
||||
Reference in New Issue
Block a user