77 lines
2.3 KiB
JavaScript
77 lines
2.3 KiB
JavaScript
const assert = require('assert');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const root = path.join(__dirname, '..');
|
|
const appContractPath = path.join(root, 'APP.openapi.json');
|
|
const obsoleteRecordPaths = [
|
|
'docs/api-page-integration-2026-07-09.md',
|
|
'docs/api-page-integration-tracker-2026-07-09.md'
|
|
];
|
|
const forbiddenPatterns = [
|
|
/\/genealogy\/app/,
|
|
/\bAPP_(?:LOGIN|REGISTER|PHONE_CHANGE|FORGOT_PASSWORD|SMS_CODE|ACCOUNT_DEACTIVATE)\b/,
|
|
/APP\.openapi\.json/
|
|
];
|
|
const checkedFiles = [
|
|
'utils/ApiClient.js',
|
|
'public/js/auth-pages.js',
|
|
'public/js/captcha-pages.js',
|
|
'login.html',
|
|
'register.html',
|
|
'forgot-password.html',
|
|
'app.html',
|
|
'download.html',
|
|
'notice-detail.html',
|
|
'profile-album.html',
|
|
'profile-data.html',
|
|
'profile-gift.html',
|
|
'profile-security.html',
|
|
'profile-services.html',
|
|
'profile-tree.html',
|
|
'genealogy-pc-openapi.yaml',
|
|
'docs/pc-api-page-integration-tracker-2026-07-09.md',
|
|
'docs/superpowers/plans/2026-07-09-pc-api-replan.md',
|
|
'docs/superpowers/plans/2026-07-09-pc-auth-three-pages.md',
|
|
'docs/superpowers/plans/2026-07-09-tac-captcha-auth.md',
|
|
'docs/superpowers/plans/2026-07-10-pc-tracker-reverification.md',
|
|
'public/js/album-pages.js',
|
|
'public/js/article-pages.js',
|
|
'public/js/ceremony-pages.js',
|
|
'public/js/feed-pages.js',
|
|
'public/js/genealogy-pages.js',
|
|
'public/js/growth-pages.js',
|
|
'public/js/lineage-pages.js',
|
|
'public/js/member-admin-pages.js',
|
|
'public/js/memo-pages.js',
|
|
'public/js/vip-pages.js'
|
|
];
|
|
|
|
function read(relativePath) {
|
|
return fs.readFileSync(path.join(root, relativePath), 'utf8');
|
|
}
|
|
|
|
function run() {
|
|
const apiClient = read('utils/ApiClient.js');
|
|
const authPages = read('public/js/auth-pages.js');
|
|
|
|
assert.strictEqual(fs.existsSync(appContractPath), false);
|
|
obsoleteRecordPaths.forEach((relativePath) => {
|
|
assert.strictEqual(fs.existsSync(path.join(root, relativePath)), false, `${relativePath} must be removed`);
|
|
});
|
|
assert.match(apiClient, /\/genealogy\/pc\/auth\/login\/sms/);
|
|
assert.match(authPages, /captchaScene: 'WEB_H5_LOGIN'/);
|
|
|
|
checkedFiles.forEach((relativePath) => {
|
|
const content = read(relativePath);
|
|
|
|
forbiddenPatterns.forEach((pattern) => {
|
|
assert.doesNotMatch(content, pattern, `${relativePath} must not retain APP API contracts`);
|
|
});
|
|
});
|
|
|
|
console.log('pc-api-contract tests passed');
|
|
}
|
|
|
|
run();
|