feat(user): add logout, demo account switcher and guest state support

这个提交包含在:
xcbyy
2026-10-10 16:20:55 +08:00
父节点 3a700c42a1
当前提交 593d44bdbd
共有 2 个文件被更改,包括 499 次插入 和 13 次删除

查看文件

@@ -375,5 +375,35 @@ describe('ContentSecurityService & Compliance Architecture (TDD 微信内容安
}
});
});
describe('10. 个人中心未登录游客态、退出登录及切换账号门禁验证 (用户体验闭环与安全防范)', () => {
it('个人中心页面必须包含退出登录、切换账号与登录弹窗入口', () => {
const userIndexPath = path.join(rootDir, 'pwuniapp', 'pages', 'user', 'index.vue');
const content = fs.readFileSync(userIndexPath, 'utf-8');
expect(content).toContain('handleLogout');
expect(content).toContain('switchDemoAccount');
expect(content).toContain('openLoginModal');
expect(content).toContain('isLoggedIn');
expect(content).toContain('account-actions-card');
expect(content).toContain('login-modal-mask');
expect(content).toContain('退出当前登录');
expect(content).toContain('切换账号');
expect(content).toContain('微信一键授权快捷登录');
});
it('个人中心核心交互必须包含未登录拦截守护 ensureLoggedIn', () => {
const userIndexPath = path.join(rootDir, 'pwuniapp', 'pages', 'user', 'index.vue');
const content = fs.readFileSync(userIndexPath, 'utf-8');
expect(content).toContain('const ensureLoggedIn = () =>');
expect(content).toContain('if (!ensureLoggedIn()) return;');
});
it('所有个人中心改造代码严禁包含任何系统 Emoji', () => {
const userIndexPath = path.join(rootDir, 'pwuniapp', 'pages', 'user', 'index.vue');
const text = fs.readFileSync(userIndexPath, 'utf-8');
const emojiRegex = /(?:\p{Extended_Pictographic}|\p{Emoji_Presentation}|[\u2600-\u27BF])/u;
expect(emojiRegex.test(text)).toBe(false);
});
});
});