fix(admin): restore review workspace and add user account editing
This commit is contained in:
@@ -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();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user