文件
OmniCard/mpuniapp/tests/owner-profile.test.ts

55 行
3.0 KiB
TypeScript

import test from 'node:test';
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
const MP_ROOT = path.resolve('m:/2026项目/CRMmp/mpuniapp');
const profileUtsPath = path.join(MP_ROOT, 'pages/owner/profile/useProfile.uts');
const profileUvuePath = path.join(MP_ROOT, 'pages/owner/profile/index.uvue');
test('1. useProfile.uts 必须包含名片工作室所有核心文案键', () => {
assert.ok(fs.existsSync(profileUtsPath), '必须存在 useProfile.uts');
const content = fs.readFileSync(profileUtsPath, 'utf-8');
assert.ok(content.includes('cardStudioSection'), '必须包含 cardStudioSection');
assert.ok(content.includes('myCards'), '必须包含 myCards');
assert.ok(content.includes('cardEdit'), '必须包含 cardEdit');
assert.ok(content.includes('productCases'), '必须包含 productCases');
assert.ok(content.includes('articleDynamics'), '必须包含 articleDynamics');
assert.ok(content.includes('sharePoster'), '必须包含 sharePoster');
assert.ok(content.includes('exchangeHall'), '必须包含 exchangeHall');
assert.ok(content.includes('editProfile'), '必须包含 editProfile');
});
test('2. profile/index.uvue 零 Emoji 违规审查', () => {
const emojiRegex = /[\u{1F300}-\u{1F9FF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}]/u;
const content = fs.readFileSync(profileUvuePath, 'utf-8');
assert.equal(emojiRegex.test(content), false, 'profile/index.uvue 严禁含有 Emoji');
});
test('3. profile/index.uvue 必须完整挂载数字名片工作室 6 大业务入口', () => {
const content = fs.readFileSync(profileUvuePath, 'utf-8');
assert.ok(content.includes('/pages/owner/card/index'), '必须包含我的名片列表入口');
assert.ok(content.includes('/pages/owner/card/edit'), '必须包含名片极速维护入口');
assert.ok(content.includes('/pages/owner/card/cases'), '必须包含产品相册与案例入口');
assert.ok(content.includes('/pages/owner/card/articles'), '必须包含文章与商务动态入口');
assert.ok(content.includes('/pages/owner/card/qrcode'), '必须包含分享海报入口');
assert.ok(content.includes('/pages/owner/hall/index'), '必须包含名片互换大厅入口');
});
test('4. openPage 跳转逻辑必须支持 TabBar 页面使用 uni.switchTab 防止死链', () => {
const content = fs.readFileSync(profileUvuePath, 'utf-8');
assert.ok(content.includes('uni.switchTab'), 'TabBar 页面必须调用 uni.switchTab 跳转');
assert.ok(content.includes('uni.navigateTo'), '常规页面调用 uni.navigateTo 跳转');
assert.ok(content.includes('/pages/owner/card/index'), 'TabBar 判断列表必须包含 /pages/owner/card/index');
});
test('5. 个人资料顶部身份区域与配额进度条具备点击交互响应', () => {
const content = fs.readFileSync(profileUvuePath, 'utf-8');
assert.ok(content.includes('onEditProfileClick'), '顶部身份卡片必须具备 onEditProfileClick');
assert.ok(content.includes('onQuotaClick'), '配额进度条必须具备 onQuotaClick 交互反馈');
});