2026-10-21 17:34:03 +08:00
|
|
|
const assert = require('node:assert/strict')
|
|
|
|
|
const fs = require('node:fs')
|
|
|
|
|
const path = require('node:path')
|
|
|
|
|
|
|
|
|
|
const root = path.resolve(__dirname, '..')
|
|
|
|
|
const tabLayout = fs.readFileSync(path.join(root, 'src/layouts/TabLayout.vue'), 'utf8')
|
|
|
|
|
const pageLayout = fs.readFileSync(path.join(root, 'src/layouts/PageLayout.vue'), 'utf8')
|
|
|
|
|
const home = fs.readFileSync(path.join(root, 'src/pages/home/HomePage.vue'), 'utf8')
|
2026-10-21 23:41:47 +08:00
|
|
|
const workbench = fs.readFileSync(path.join(root, 'src/pages/operator/OperatorWorkbenchPage.vue'), 'utf8')
|
|
|
|
|
const serviceDetail = fs.readFileSync(path.join(root, 'src/pages/operator/OperatorServiceDetailPage.vue'), 'utf8')
|
|
|
|
|
const matchmakerApi = fs.readFileSync(path.join(root, 'src/api/services/matchmaker.ts'), 'utf8')
|
|
|
|
|
const discover = fs.readFileSync(path.join(root, 'src/pages/discover/DiscoverPage.vue'), 'utf8')
|
|
|
|
|
const userCard = fs.readFileSync(path.join(root, 'src/components/UiUserCard.vue'), 'utf8')
|
|
|
|
|
const routes = fs.readFileSync(path.join(root, 'src/router/routes.ts'), 'utf8')
|
2026-10-21 17:34:03 +08:00
|
|
|
|
2026-10-21 23:41:47 +08:00
|
|
|
assert.doesNotMatch(tabLayout, /to="\/messages"[^>]*>消息<\/van-tabbar-item>/)
|
|
|
|
|
assert.match(tabLayout, /to="\/notifications"[^>]*>通知<\/van-tabbar-item>/)
|
2026-10-21 17:34:03 +08:00
|
|
|
assert.match(pageLayout, /class="page-layout__nav"/)
|
|
|
|
|
assert.match(home, /home-hero-v2\.jpg/)
|
2026-10-21 23:41:47 +08:00
|
|
|
assert.match(home, /home__notice[^\n]*notifications/)
|
2026-10-21 17:34:03 +08:00
|
|
|
assert.doesNotMatch(home, /home__banner-cover[^\n]*\{\{ \(b\.title \|\| '善'\)\.slice\(0, 1\) \}\}/)
|
2026-10-21 23:41:47 +08:00
|
|
|
assert.match(workbench, /服务工作台/)
|
|
|
|
|
assert.match(workbench, /v-for="item in filteredServices"/)
|
|
|
|
|
assert.match(workbench, /activeServiceTab/)
|
|
|
|
|
assert.match(workbench, /createDemoUser/)
|
|
|
|
|
assert.match(workbench, /assignToSelf/)
|
|
|
|
|
assert.match(workbench, /query: \{ id: serviceId, source \}/)
|
|
|
|
|
assert.match(serviceDetail, /route\.query\.source === 'management'[\s\S]*?managementServiceDetail\(serviceId\)/)
|
|
|
|
|
assert.match(matchmakerApi, /managementServiceDetail\(id: string\)[\s\S]*?\/operator\/matchmaker\/management\/services\//)
|
|
|
|
|
assert.match(discover, /class="discover__hero"/)
|
|
|
|
|
assert.match(discover, /placeholder="姓名、职业或地区"/)
|
|
|
|
|
assert.match(discover, />推荐<|>年龄<|>学历<|>婚姻</)
|
|
|
|
|
assert.match(discover, /van-slider/)
|
|
|
|
|
assert.match(discover, /:show-pass="false"/)
|
|
|
|
|
assert.match(userCard, /occupationLabel\(user\.occupationCode\)/)
|
|
|
|
|
assert.match(userCard, /maritalLabel\(user\.maritalStatus\)/)
|
|
|
|
|
assert.doesNotMatch(routes, /path: ['"]messages['"]|name: ['"]MessagesPage['"]|MessagesPage/)
|
|
|
|
|
assert.doesNotMatch(routes, /path: ['"]chat['"]|name: ['"]Chat/)
|
2026-10-21 17:34:03 +08:00
|
|
|
|
|
|
|
|
console.log('PASS: H5 UI contract')
|