fix(admin): restore review workspace and add user account editing

This commit is contained in:
gr
2026-11-03 14:10:56 +08:00
parent 3cb30a7574
commit f7f323462c
82 changed files with 5281 additions and 2095 deletions
@@ -0,0 +1,32 @@
import type { RouteRecordRaw } from 'vue-router';
import { describe, expect, it } from 'vitest';
import { firstMenuPath, parentPaths, pruneEmptyMenus } from './menu-access';
const routes = [
{ children: [{ path: 'catalog' }], path: '/model' },
{ children: [{ path: 'accounts' }], path: '/desktop' },
{ children: [{ path: 'center' }], path: '/knowledge' },
{ path: '/profile' },
] as unknown as RouteRecordRaw[];
describe('menus after button-level filtering', () => {
it('drops top-level menus whose pages were all filtered out', () => {
const menus = [
{ children: [{ path: '/model/catalog' }], path: '/model' },
{ children: [], path: '/desktop' },
{ children: [{ path: '/knowledge/center' }], path: '/knowledge' },
{ path: '/profile' },
];
expect(pruneEmptyMenus(menus, parentPaths(routes)).map((menu) => menu.path)).toEqual(['/model', '/knowledge', '/profile']);
});
it('lands on the first page the user can open', () => {
expect(firstMenuPath([
{ path: '/profile', show: false },
{ children: [{ path: 'https://example.com/report' }, { path: '/knowledge/center' }], path: '/knowledge' },
])).toBe('/knowledge/center');
expect(firstMenuPath([])).toBeUndefined();
});
});