完成10%

This commit is contained in:
rain
2026-07-24 18:11:16 +08:00
parent 8716a68fdb
commit 8870136d1b
33 changed files with 3853 additions and 336 deletions
+10 -15
View File
@@ -16,29 +16,22 @@ test('配置始终使用后端提供的 PC 接口地址', () => {
assert.equal(development.getEnvironment(), 'development');
assert.equal(production.getEnvironment(), 'production');
assert.equal(development.getApiBaseUrl(), 'http://182.61.18.23:8080');
assert.equal(production.getApiBaseUrl(), 'http://182.61.18.23:8080');
assert.equal(development.getApiBaseUrl(), 'https://backend-api.ddxcjp.cn/');
assert.equal(production.getApiBaseUrl(), 'https://backend-api.ddxcjp.cn/');
});
test('最新 OpenAPI 文档包含已交付的家族圈接口', () => {
const contract = JSON.parse(read('PC.openapi2.json'));
test('PC 对接规划明确以 Apifox 目录而非导出快照为契约源', () => {
const plan = read('docs/PC接口对接规划.md');
assert.ok(contract.paths['/genealogy/pc/auth/login']);
assert.ok(contract.paths['/genealogy/pc/files/upload']);
assert.ok(contract.paths['/genealogy/region/children']);
assert.ok(contract.paths['/genealogy/pc/genealogies/{genealogyId}/feeds']);
assert.ok(contract.paths['/genealogy/pc/genealogies/{genealogyId}/feeds/{feedId}/comments/{commentId}']);
});
test('旧 YAML 明确指向最新 JSON 接口源', () => {
assert.match(read('PC.openapi.yaml'), /正式接口源为 PC\.openapi2\.json/);
assert.match(plan, /Apifox 的 PC 目录是 PC 前端接口的唯一正式契约源/);
assert.match(plan, /旧 OpenAPI 文件不再作为新增功能依据/);
});
test('pages do not load scripts for unavailable business APIs', () => {
const removedScripts = [
'album-pages.js', 'article-pages.js', 'ceremony-pages.js',
'feedback-pages.js', 'genealogy-pages.js', 'generation-pages.js', 'growth-pages.js',
'help-pages.js', 'join-apply-pages.js', 'lineage-pages.js', 'member-admin-pages.js',
'feedback-pages.js', 'genealogy-pages.js', 'growth-pages.js',
'help-pages.js', 'join-apply-pages.js', 'member-admin-pages.js',
'memo-pages.js', 'notification-pages.js', 'promotion-pages.js', 'vip-pages.js'
];
const retainedPages = fs.readdirSync(root).filter((entry) => entry.endsWith('.html'));
@@ -53,4 +46,6 @@ test('pages do not load scripts for unavailable business APIs', () => {
['profile-feed.html', 'profile-feed-edit.html'].forEach((page) => {
assert.equal(read(page).includes('src="public/js/feed-pages.js"'), true, `${page} must load feed-pages.js`);
});
assert.equal(read('profile-generation.html').includes('src="public/js/generation-pages.js"'), true, 'profile-generation.html must load generation-pages.js');
assert.equal(read('profile-tree.html').includes('src="public/js/lineage-pages.js"'), true, 'profile-tree.html must load lineage-pages.js');
});