309598bfa6
- 在ApiClient中新增submitFeedback、myFeedback、helpArticles、helpArticleDetail、 siteArticles、promotions、vipPackages、createVipOrder、vipOrders等方法 - 添加帮助文章和站点资讯的参数验证逻辑 - 更新测试文件添加新的API方法测试用例 - 在HTML页面中添加反馈、帮助和VIP服务相关页面的脚本引用 - 更新加入家谱页面为完整的申请流程界面 - 修改资讯详情页面为站点资讯展示页面 - 更新AxiosRequestUtil中认证处理逻辑 - 添加世系树渲染的HTML生成函数用于页面复用 - 更新文档中的API契约说明和页面规划
118 lines
7.1 KiB
JavaScript
118 lines
7.1 KiB
JavaScript
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
const test = require('node:test');
|
|
|
|
const PageAvailability = require('../public/js/pending-pages.js');
|
|
|
|
const root = path.resolve(__dirname, '..');
|
|
const familyPendingPages = [
|
|
'profile-invite.html',
|
|
];
|
|
|
|
const contentPendingPages = [
|
|
'profile-admin-permissions.html',
|
|
'profile-data-reminders.html'
|
|
];
|
|
|
|
const residualPendingPages = [
|
|
'profile-share.html'
|
|
];
|
|
|
|
const pendingPages = familyPendingPages.concat(contentPendingPages, residualPendingPages);
|
|
|
|
function read(relativePath) {
|
|
return fs.readFileSync(path.join(root, relativePath), 'utf8');
|
|
}
|
|
|
|
function createLink(attributes) {
|
|
return {
|
|
getAttribute(name) {
|
|
return Object.prototype.hasOwnProperty.call(attributes, name) ? attributes[name] : null;
|
|
}
|
|
};
|
|
}
|
|
|
|
test('待开发页面生成明确且转义后的状态提示', () => {
|
|
assert.match(PageAvailability.buildBanner('家谱基础服务正在开发中'), /家谱基础服务正在开发中/);
|
|
assert.match(PageAvailability.buildBanner('<script>'), /<script>/);
|
|
});
|
|
|
|
test('待开发页面显式加载状态脚本', () => {
|
|
pendingPages.forEach((page) => {
|
|
const source = read(page);
|
|
|
|
assert.match(source, /data-feature-status="pending"/, `${page} 缺少待开发状态标记`);
|
|
assert.match(source, /src="public\/js\/pending-pages\.js"/, `${page} 未加载状态脚本`);
|
|
});
|
|
});
|
|
|
|
test('已接入的家谱业务页面保持真实功能状态', () => {
|
|
['profile-families.html', 'profile-create-family.html', 'profile-join-family.html', 'profile-join-review.html', 'profile-family-home.html', 'profile-family-admin.html', 'profile-feedback.html', 'profile-services.html', 'profile-content.html', 'profile-feed.html', 'profile-feed-edit.html', 'profile-feed-detail.html', 'profile-generation.html', 'profile-tree.html', 'profile-article.html', 'profile-article-edit.html', 'profile-album.html', 'profile-album-edit.html', 'profile-album-detail.html', 'profile-video.html', 'profile-video-edit.html', 'profile-gift.html', 'profile-gift-edit.html', 'profile-ceremony.html', 'profile-ceremony-detail.html', 'profile-growth.html', 'profile-growth-edit.html', 'profile-relative.html', 'profile-relative-edit.html', 'profile-memo.html', 'profile-memo-edit.html', 'profile-merit.html', 'profile-merit-edit.html', 'profile-messages.html'].forEach((page) => {
|
|
assert.doesNotMatch(read(page), /data-feature-status="pending"/, `${page} 不应标记为待开发`);
|
|
});
|
|
assert.match(read('profile-generation.html'), /src="public\/js\/generation-pages\.js"/);
|
|
assert.match(read('profile-families.html'), /src="public\/js\/genealogy-entry-pages\.js"/);
|
|
assert.match(read('profile-create-family.html'), /src="public\/js\/genealogy-entry-pages\.js"/);
|
|
assert.match(read('profile-join-family.html'), /src="public\/js\/join-pages\.js"/);
|
|
assert.match(read('profile-join-review.html'), /src="public\/js\/join-review-pages\.js"/);
|
|
assert.match(read('profile-feedback.html'), /src="public\/js\/feedback-pages\.js"/);
|
|
assert.match(read('profile-services.html'), /src="public\/js\/vip-pages\.js"/);
|
|
assert.match(read('profile-family-home.html'), /src="public\/js\/family-home-pages\.js"/);
|
|
assert.match(read('profile-tree.html'), /src="public\/js\/lineage-pages\.js"/);
|
|
assert.match(read('profile-family-admin.html'), /src="public\/js\/member-admin-pages\.js"/);
|
|
assert.match(read('profile-article.html'), /src="public\/js\/article-pages\.js"/);
|
|
assert.match(read('profile-article-edit.html'), /src="public\/js\/article-pages\.js"/);
|
|
assert.match(read('profile-album.html'), /src="public\/js\/album-pages\.js"/);
|
|
assert.match(read('profile-album-edit.html'), /src="public\/js\/album-pages\.js"/);
|
|
assert.match(read('profile-album-detail.html'), /src="public\/js\/album-pages\.js"/);
|
|
assert.match(read('profile-video.html'), /src="public\/js\/video-pages\.js"/);
|
|
assert.match(read('profile-video-edit.html'), /src="public\/js\/video-pages\.js"/);
|
|
assert.match(read('profile-gift.html'), /src="public\/js\/ceremony-pages\.js"/);
|
|
assert.match(read('profile-gift-edit.html'), /src="public\/js\/ceremony-admin-pages\.js"/);
|
|
assert.match(read('profile-ceremony.html'), /src="public\/js\/ceremony-admin-pages\.js"/);
|
|
assert.match(read('profile-ceremony-detail.html'), /src="public\/js\/ceremony-admin-pages\.js"/);
|
|
assert.match(read('profile-growth.html'), /src="public\/js\/growth-pages\.js"/);
|
|
assert.match(read('profile-growth-edit.html'), /src="public\/js\/growth-pages\.js"/);
|
|
assert.match(read('profile-relative.html'), /src="public\/js\/relative-pages\.js"/);
|
|
assert.match(read('profile-relative-edit.html'), /src="public\/js\/relative-pages\.js"/);
|
|
assert.match(read('profile-memo.html'), /src="public\/js\/memo-pages\.js"/);
|
|
assert.match(read('profile-merit.html'), /src="public\/js\/merit-pages\.js"/);
|
|
assert.match(read('profile-merit-edit.html'), /src="public\/js\/merit-pages\.js"/);
|
|
assert.match(read('profile-messages.html'), /src="public\/js\/notification-pages\.js"/);
|
|
assert.match(read('profile-memo-edit.html'), /src="public\/js\/memo-pages\.js"/);
|
|
});
|
|
|
|
test('待开发的家谱管理页明确放行已接入的字辈入口并透传上下文', () => {
|
|
const familyAdmin = read('profile-family-admin.html');
|
|
const profileCommon = read('public/js/profile-common.js');
|
|
|
|
assert.match(familyAdmin, /href="profile-generation\.html" data-feature-link="available" data-genealogy-context-link/);
|
|
assert.match(profileCommon, /function syncGenealogyContextLinks\(\)/);
|
|
assert.match(profileCommon, /params\.set\('genealogyId', genealogyId\)/);
|
|
});
|
|
|
|
test('待开发页面仅放行显式标记的可用功能入口', () => {
|
|
assert.equal(PageAvailability.shouldBlockLink(createLink({ href: 'profile-share.html' })), true);
|
|
assert.equal(PageAvailability.shouldBlockLink(createLink({ href: 'profile-feed.html', 'data-feature-link': 'available' })), false);
|
|
assert.equal(PageAvailability.shouldBlockLink(createLink({ href: '#section' })), false);
|
|
});
|
|
|
|
test('内容入口明确保留家族圈动态跳转', () => {
|
|
assert.match(read('profile-content.html'), /href="profile-feed\.html" data-feature-link="available"/);
|
|
assert.match(read('profile-content.html'), /href="profile-growth\.html" data-feature-link="available" data-genealogy-context-link/);
|
|
assert.match(read('profile-content.html'), /href="profile-relative\.html" data-feature-link="available" data-genealogy-context-link/);
|
|
assert.match(read('profile-content.html'), /href="profile-memo\.html" data-feature-link="available" data-genealogy-context-link/);
|
|
assert.match(read('profile-content.html'), /href="profile-merit\.html" data-feature-link="available" data-genealogy-context-link/);
|
|
});
|
|
|
|
test('家谱主页明确保留家族圈动态跳转', () => {
|
|
assert.match(read('profile-family-home.html'), /href="profile-feed\.html" data-feature-link="available"/);
|
|
});
|
|
|
|
test('账号闭环页面保持真实功能状态', () => {
|
|
['profile.html', 'profile-data.html', 'profile-security.html'].forEach((page) => {
|
|
assert.doesNotMatch(read(page), /data-feature-status="pending"/, `${page} 不应标记为待开发`);
|
|
});
|
|
});
|