fb1743aa2a
- 实现家谱管理相关方法,包括创建、详情、概览、我的家谱和选项查询 - 添加家谱加入申请功能,支持申请、审核、取消和待审核列表操作 - 集成通知详情获取方法和通知ID安全验证机制 - 完善功德记录、谱文、相册、视频、祭祀活动的完整CRUD操作契约 - 实现家谱成员管理功能,包含成员列表、更新、移除和转让所有者操作 - 优化路径ID验证逻辑,拒绝不安全的数值ID并提供明确错误提示 - 更新测试用例以验证所有新增API方法的路径和请求体白名单机制
36 lines
1.7 KiB
JavaScript
36 lines
1.7 KiB
JavaScript
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
const test = require('node:test');
|
|
|
|
const root = path.join(__dirname, '..');
|
|
|
|
function read(file) {
|
|
return fs.readFileSync(path.join(root, file), 'utf8');
|
|
}
|
|
|
|
test('内容发布页为全部家谱功能入口透传真实家谱上下文', () => {
|
|
const page = read('profile-content.html');
|
|
|
|
assert.doesNotMatch(page, /data-feature-status="pending"|pending-pages\.js|最近内容加载中/);
|
|
['profile-article.html', 'profile-album.html', 'profile-video.html', 'profile-merit.html', 'profile-gift.html', 'profile-feed.html', 'profile-growth.html', 'profile-relative.html', 'profile-memo.html'].forEach((href) => {
|
|
assert.match(page, new RegExp('href="' + href.replace('.', '\\.') + '"[^>]*data-genealogy-context-link'), `${href} 缺少家谱上下文透传`);
|
|
});
|
|
});
|
|
|
|
test('家谱主页公开谱文、相册、视频、功德和祭祀活动入口并透传上下文', () => {
|
|
const page = read('profile-family-home.html');
|
|
|
|
['profile-article.html', 'profile-album.html', 'profile-video.html', 'profile-merit.html', 'profile-ceremony.html'].forEach((href) => {
|
|
assert.match(page, new RegExp('href="' + href.replace('.', '\\.') + '"[^>]*data-genealogy-context-link'), `${href} 缺少家谱主页入口`);
|
|
});
|
|
});
|
|
|
|
test('个人中心功能入口没有把家谱业务页当作无上下文普通链接', () => {
|
|
const page = read('profile.html');
|
|
|
|
['profile-article.html', 'profile-album.html', 'profile-video.html', 'profile-merit.html', 'profile-gift.html'].forEach((href) => {
|
|
assert.match(page, new RegExp('href="' + href.replace('.', '\\.') + '"[^>]*data-genealogy-context-link'), `${href} 缺少个人中心上下文入口`);
|
|
});
|
|
});
|