等待后端更新接口
This commit is contained in:
@@ -105,7 +105,7 @@ test('活动、祭品和邀请响应使用完整 PC VO 并拒绝不安全 ID', (
|
||||
genealogyId: '2060000000000000002',
|
||||
sponsorUserId: '2060000000000000003',
|
||||
sponsorNickName: '叶子',
|
||||
sponsorPhone: '19181970173',
|
||||
sponsorPhone: '测试联系方式',
|
||||
ceremonyType: 'ancestor',
|
||||
ceremonyTitle: '清明祭祖',
|
||||
ceremonyDesc: '缅怀先祖',
|
||||
@@ -205,7 +205,7 @@ test('活动和祭品展示转义内容且不暴露手机号、OSS ID 或内部
|
||||
genealogyId: '2060000000000000002',
|
||||
sponsorUserId: '2060000000000000003',
|
||||
sponsorNickName: '<img src=x>叶子',
|
||||
sponsorPhone: '19181970173',
|
||||
sponsorPhone: '测试联系方式',
|
||||
ceremonyType: 'ancestor',
|
||||
ceremonyTitle: '<script>alert(1)</script>祭祖',
|
||||
coverOssId: '2060000000000000004',
|
||||
@@ -226,7 +226,7 @@ test('活动和祭品展示转义内容且不暴露手机号、OSS ID 或内部
|
||||
})]);
|
||||
|
||||
assert.doesNotMatch(html, /<script|<img/);
|
||||
assert.doesNotMatch(html, /19181970173|19100000000|206000000000000000[1-6]/);
|
||||
assert.doesNotMatch(html, /测试联系方式|19100000000|206000000000000000[1-6]/);
|
||||
assert.match(html, /祭祖|缅怀|66\.66/);
|
||||
});
|
||||
|
||||
@@ -242,10 +242,58 @@ test('祭祀功能拆分列表、编辑和详情页面且不允许手填 ID', ()
|
||||
});
|
||||
assert.match(listPage, /data-ceremony-list/);
|
||||
assert.match(editPage, /name="ceremonyType"/);
|
||||
assert.match(editPage, /data-ceremony-form data-ceremony-editor hidden novalidate/);
|
||||
assert.match(editPage, /class="field-required"/);
|
||||
assert.match(editPage, /<div class="upload-status" data-ceremony-form-status/);
|
||||
assert.match(editPage, /Ceremony Editor/);
|
||||
assert.doesNotMatch(editPage, /创建贺礼|贺礼标题|贺礼内容/);
|
||||
assert.match(editPage, /name="coverOssId" type="hidden"/);
|
||||
assert.match(editPage, /name="status" type="hidden" value="0"/);
|
||||
assert.match(detailPage, /data-ceremony-gift-list/);
|
||||
assert.match(detailPage, /data-ceremony-invitee-options/);
|
||||
assert.match(detailPage, /name="giftAmount"/);
|
||||
assert.match(detailPage, /data-ceremony-gift-form data-ceremony-admin-editor hidden novalidate/);
|
||||
assert.match(detailPage, /data-ceremony-invitee-form data-ceremony-admin-editor hidden novalidate/);
|
||||
assert.match(detailPage, /<div class="upload-status" data-ceremony-gift-status/);
|
||||
assert.match(detailPage, /<div class="upload-status" data-ceremony-invitee-status/);
|
||||
assert.doesNotMatch(editPage + detailPage, /name="(?:genealogyId|ceremonyId|giftId|inviteeUserIds)"/);
|
||||
});
|
||||
|
||||
test('活动、祭品和受邀名单复用统一加载、空数据、403 与失败状态', () => {
|
||||
const projectRoot = path.join(__dirname, '..');
|
||||
const listPage = fs.readFileSync(path.join(projectRoot, 'profile-ceremony.html'), 'utf8');
|
||||
const detailPage = fs.readFileSync(path.join(projectRoot, 'profile-ceremony-detail.html'), 'utf8');
|
||||
const source = fs.readFileSync(modulePath, 'utf8');
|
||||
|
||||
assert.match(listPage, /data-ceremony-list[^>]*>[\s\S]*data-api-state="loading"/);
|
||||
assert.match(detailPage, /data-ceremony-detail[^>]*>[\s\S]*data-api-state="loading"/);
|
||||
assert.match(detailPage, /data-ceremony-gift-list[^>]*>[\s\S]*data-api-state="loading"/);
|
||||
assert.match(detailPage, /data-ceremony-invitation-list[^>]*>[\s\S]*data-api-state="loading"/);
|
||||
assert.match(detailPage, /data-ceremony-invitee-options[^>]*>[\s\S]*data-api-state="loading"/);
|
||||
assert.match(source, /root\.ProfileUI && root\.ProfileUI\.setApiState/);
|
||||
assert.match(source, /setStatus\('\[data-ceremony-list\]', '正在加载祭祀活动…', 'loading'\)/);
|
||||
assert.match(source, /setStatus\('\[data-ceremony-list\]', '暂无祭祀活动', 'empty'\)/);
|
||||
assert.match(source, /setStatus\('\[data-ceremony-gift-list\]', '暂无祭品记录', 'empty'\)/);
|
||||
assert.match(source, /setStatus\('\[data-ceremony-invitation-list\]', '暂无邀请记录', 'empty'\)/);
|
||||
assert.match(source, /当前账号无权查看或维护受邀名单。/);
|
||||
assert.match(source, /正在读取家谱权限…', 'loading'/);
|
||||
assert.match(source, /setStatus\('\[data-ceremony-form-status\]', validation, 'error'\)/);
|
||||
assert.match(source, /setStatus\('\[data-ceremony-gift-status\]', validation, 'error'\)/);
|
||||
assert.match(source, /正在更新受邀人…', 'loading'/);
|
||||
assert.match(source, /getApiStateType\(error\)/);
|
||||
});
|
||||
|
||||
test('祭祀管理只接受后端布尔能力字段,并在全部写路径上门控', () => {
|
||||
const source = fs.readFileSync(modulePath, 'utf8');
|
||||
const canEditCeremonies = requireFunction('canEditCeremonies');
|
||||
|
||||
assert.equal(canEditCeremonies({ canEditContent: true }), true);
|
||||
assert.equal(canEditCeremonies({ canManage: true }), true);
|
||||
assert.equal(canEditCeremonies({ canEditContent: 'true', canManage: false }), false);
|
||||
assert.match(source, /canEditContent = canEditCeremonies\(detail\)/);
|
||||
assert.match(source, /root\.AppRichEditor && root\.AppRichEditor\.syncAll/);
|
||||
assert.match(source, /if \(writePending \|\| !canEditContent \|\| !genealogyId \|\| redirectUnauthorized\(api\)\) return;/);
|
||||
assert.match(source, /if \(writePending \|\| !canEditContent \|\| !genealogyId \|\| !ceremonyId \|\| redirectUnauthorized\(api\)\) return;/);
|
||||
assert.match(source, /if \(writePending \|\| !canEditContent \|\| !genealogyId \|\| !normalizeId\(ceremonyId\) \|\| redirectUnauthorized\(api\)\) return;/);
|
||||
assert.match(source, /if \(writePending \|\| !canEditContent \|\| !genealogyId \|\| !ceremonyId \|\| !normalizeId\(giftId\) \|\| redirectUnauthorized\(api\)\) return;/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user