feat: refine merged venue home and auth states
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
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 pages = [
|
||||
'pages/comprehensive/bookings/index.vue',
|
||||
'pages/comprehensive/profile/index.vue'
|
||||
]
|
||||
|
||||
const expectIncludes = (content, expected, label) => {
|
||||
if (!content.includes(expected)) failures.push(`${label} is missing: ${expected}`)
|
||||
}
|
||||
|
||||
const expectExcludes = (content, unexpected, label) => {
|
||||
if (content.includes(unexpected)) failures.push(`${label} should not contain: ${unexpected}`)
|
||||
}
|
||||
|
||||
for (const page of pages) {
|
||||
const content = readFileSync(resolve(srcRoot, page), 'utf8')
|
||||
expectIncludes(content, 'v-if="!session.isLoggedIn"', `${page} unauth condition`)
|
||||
expectIncludes(content, '<StatePanel', `${page} unauth component`)
|
||||
expectIncludes(content, 'type="login"', `${page} login state type`)
|
||||
expectIncludes(content, ':show-mark="false"', `${page} login state mark`)
|
||||
expectIncludes(content, "import StatePanel from '@/components/ice/StatePanel.vue'", `${page} StatePanel import`)
|
||||
expectExcludes(content, '星河综合运动中心', `${page} unauth copy`)
|
||||
expectExcludes(content, '登录后查看', `${page} unauth copy`)
|
||||
expectExcludes(content, 'class="brand"', `${page} brand style`)
|
||||
expectExcludes(content, 'class="desc"', `${page} desc style`)
|
||||
}
|
||||
|
||||
if (failures.length) {
|
||||
console.error(`Comprehensive auth state verification failed with ${failures.length} issue(s):`)
|
||||
for (const failure of failures) console.error(`- ${failure}`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
console.log('Comprehensive auth state verification passed.')
|
||||
Reference in New Issue
Block a user