test(live): 菜单树 smoke 兼容生产扁平 group-* 标记形态与本地嵌套形态;生产 8/8 live smoke 通过(登录/菜单/各域列表)

This commit is contained in:
2026-09-05 23:45:16 +08:00
parent efada31764
commit c381527528
2 changed files with 12 additions and 2 deletions
@@ -41,6 +41,11 @@ test('test_live_024_menu_tree_real_request', { skip: !HAS_CREDS }, async () => {
const tree = parseMenuTree(body)
assert.ok(Array.isArray(tree))
assert.ok(tree.length > 0, 'super_admin 应能拿到全部 admin 菜单树')
// 兼容两种后端形态:嵌套 children 分组 或 扁平 group-* 标记项(原始字段 route_path)。
const accountGroup = tree.find((n) => n.children?.length)
assert.ok(accountGroup, '菜单树应按分组组织')
const hasMarkers = tree.some((n) => {
const route = (n as { route_path?: string; route?: string }).route_path || (n as { route?: string }).route || ''
return route.startsWith('group-')
})
assert.ok(accountGroup || hasMarkers, '菜单树应按分组组织(嵌套或 group-* 标记)')
})