fix: guard profile auth and logout
This commit is contained in:
@@ -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');
|
||||
Reference in New Issue
Block a user