test: 修复测试用例并提升测试覆盖率

- 修复 User Journey 测试中的菜单导航和登出问题
- 更新 vitest 配置以包含 role-based-tests
- 修复 role-auth-manager 测试中的 mock 问题
- 测试通过率从 70% 提升到 100%
This commit is contained in:
张翔
2026-04-28 16:32:50 +08:00
parent f44cee4958
commit 330828f585
3 changed files with 35 additions and 107 deletions
@@ -50,7 +50,8 @@ describe('RoleAuthManager', () => {
it('should throw error on authentication failure', async () => {
(global.fetch as any).mockResolvedValueOnce({
ok: false,
statusText: 'Unauthorized'
statusText: 'Unauthorized',
text: async () => 'Invalid credentials'
});
await expect(RoleAuthManager.getRoleToken('admin')).rejects.toThrow('Authentication failed');