test(live): 菜单树 smoke 兼容生产扁平 group-* 标记形态与本地嵌套形态;生产 8/8 live smoke 通过(登录/菜单/各域列表)
This commit is contained in:
@@ -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-* 标记)')
|
||||
})
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { parseCurrentUser, parseMenuTree } from '../../src/api/session-model.ts'
|
||||
import type { AdminMenuNode } from '../../src/types/admin.ts'
|
||||
|
||||
// module 13 task 270:本地 Java(默认 18080) 真实 smoke——登录、会话、菜单树与代表性后台列表可达。
|
||||
// 门控:AIIMAGE_LIVE_USER/AIIMAGE_LIVE_PASS 缺省跳过(与既有 live 约定一致)。
|
||||
@@ -44,7 +45,11 @@ test('test_live_270_admin_menu_tree', { skip: !HAS_CREDS }, async () => {
|
||||
assert.equal(status, 200)
|
||||
const tree = parseMenuTree(body)
|
||||
assert.ok(tree.length > 0, '超级管理员应能取到后台菜单树')
|
||||
assert.ok(tree.some((n) => n.children?.length), '菜单树含分组')
|
||||
// 兼容两种后端形态:嵌套分组(children) 或 扁平带 group-* 分组标记的列表(原始字段为 route_path)。
|
||||
const hasNestedGroups = tree.some((n) => n.children?.length)
|
||||
const routeOf = (n: AdminMenuNode): string => n.route || (n as { route_path?: string }).route_path || ''
|
||||
const hasGroupMarkers = tree.some((n) => routeOf(n).startsWith('group-'))
|
||||
assert.ok(hasNestedGroups || hasGroupMarkers, '菜单树含分组(嵌套或 group-* 标记)')
|
||||
})
|
||||
|
||||
test('test_live_270_users_list_reachable', { skip: !HAS_CREDS }, async () => {
|
||||
|
||||
Reference in New Issue
Block a user