等待后端更新接口

This commit is contained in:
2026-08-03 16:49:26 +08:00
parent ac5823547a
commit 5b79893650
131 changed files with 5324 additions and 1392 deletions
+57
View File
@@ -9,6 +9,21 @@ function read(relativePath) {
return fs.readFileSync(path.join(root, relativePath), 'utf8');
}
test('项目文档不记录测试手机号', () => {
const docsRoot = path.join(root, 'docs');
const phonePattern = /(?:^|[^0-9])1[3-9][0-9]{9}(?![0-9])/;
fs.readdirSync(docsRoot, { recursive: true })
.filter((entry) => entry.endsWith('.md'))
.forEach((entry) => {
assert.doesNotMatch(
fs.readFileSync(path.join(docsRoot, entry), 'utf8'),
phonePattern,
'文档不应包含手机号:' + entry
);
});
});
test('配置始终使用后端提供的 PC 接口地址', () => {
const createConfig = require('../config.js');
const development = createConfig({ location: { hostname: 'localhost', port: '5500' } });
@@ -29,9 +44,12 @@ test('配置始终使用后端提供的 PC 接口地址', () => {
test('PC 对接规划记录本轮由用户指定的 YAML 冻结契约', () => {
const plan = read('docs/PC接口对接规划.md');
const handover = read('docs/交接文档.md');
assert.match(plan, /genealogy-pc-openapi\.yaml` 对接,因此该 YAML 是本轮冻结契约/);
assert.match(plan, /旧 OpenAPI 文件不再作为新增功能依据/);
assert.match(handover, /本文第二至第七节均为当日历史快照/);
assert.match(handover, /不得据此新增、关闭或阻断任何功能/);
});
test('pages do not load scripts for unavailable business APIs', () => {
@@ -73,3 +91,42 @@ test('pages do not load scripts for unavailable business APIs', () => {
assert.equal(read('profile-memo.html').includes('src="public/js/memo-pages.js"'), true, 'profile-memo.html must load memo-pages.js');
assert.equal(read('profile-services.html').includes('src="public/js/vip-pages.js"'), true, 'profile-services.html must load vip-pages.js');
});
test('个人中心将参考账户与家谱能力映射到 PC 工作台,未声明项不伪造操作', () => {
const profile = read('profile.html');
const services = read('profile-services.html');
const share = read('profile-share.html');
const familyHome = read('profile-family-home.html');
const content = read('profile-content.html');
const apiClient = read('utils/ApiClient.js');
const verification = read('docs/验证20%记录.md');
const mapping = read('docs/个人中心能力映射.md');
['profile-data.html', 'profile-security.html', 'profile-feedback.html', 'profile-services.html'].forEach((page) => {
assert.match(profile, new RegExp('href="' + page.replace('.', '\\.') + '"'));
});
assert.match(profile, /data-logout-open/);
assert.match(services, /href="help\.html"/);
assert.match(services, /href="about\.html"/);
assert.match(services, /应用分享与收益[\s\S]+?当前不提供不可用的跳转入口/);
assert.match(services, /个性化推荐[\s\S]+?暂不能设置推荐开关/);
assert.doesNotMatch(services, /data-(?:share|withdraw|recommendation)-(?:form|toggle)/);
assert.doesNotMatch(share, /data-feature-status="pending"|pending-pages\.js|data-(?:share|withdraw)-(?:form|toggle)/);
assert.match(share, /当前 PC 未声明应用分享、奖励、收益或提现的正式接口/);
assert.match(familyHome, /class="module-card is-unavailable" aria-disabled="true">\s*<span class="icon">邀<\/span>\s*<h3>邀请家人<\/h3>/);
assert.match(familyHome, /重要证件[\s\S]+?暂不能查看或保存/);
assert.match(familyHome, /删除家谱[\s\S]+?暂不能查看或执行删除操作/);
assert.doesNotMatch(familyHome, /data-genealogy-delete|deleteGenealogy/);
assert.match(content, /亲友往来(贺礼簿)/);
assert.match(content, /备忘录(家族恩人)/);
assert.doesNotMatch(apiClient, /\/pages\/(?:mine|index)\//);
assert.doesNotMatch(apiClient, /deleteGenealogy/);
assert.doesNotMatch(apiClient, /(?:withdrawal|shareReward|recommendationPreference|documentRecords)/);
assert.match(verification, /资料提醒、家谱邀请、家谱删除、家谱排序、分享奖励、推广收益与提现/);
assert.match(mapping, /`Jiapu-App` 只作为产品信息架构参考/);
['profile-data.html', 'profile-security.html', 'profile-family-home.html', 'profile-tree.html', 'profile-feed.html', 'profile-services.html'].forEach((page) => {
assert.match(mapping, new RegExp('`' + page.replace('.', '\\.') + '`'));
assert.equal(fs.existsSync(path.join(root, page)), true, `映射页面不存在:${page}`);
});
assert.doesNotMatch(mapping, /\/pages\//);
});