fix: guard profile auth and logout

This commit is contained in:
rain
2026-07-11 09:32:06 +08:00
parent 8b896f4ba3
commit f60cc67749
5 changed files with 82 additions and 4 deletions
+15
View File
@@ -0,0 +1,15 @@
const assert = require('assert');
const fs = require('fs');
const path = require('path');
const profileHtml = fs.readFileSync(path.join(__dirname, '..', 'profile.html'), 'utf8');
const profileCommon = fs.readFileSync(path.join(__dirname, '..', 'public', 'js', 'profile-common.js'), 'utf8');
assert.match(profileHtml, /data-logout-confirm/);
assert.match(profileHtml, /<a class="btn primary magnetic" href="index\.html" data-logout-confirm>/);
assert.match(profileHtml, /<span>退出登录<\/span><b>返回首页<\/b>/);
assert.match(profileCommon, /function performLogout\(targetUrl\)/);
assert.match(profileCommon, /api\.logout\(\)/);
assert.match(profileCommon, /targetUrl \|\| 'index\.html'/);
console.log('profile logout structure tests passed');