优化
This commit is contained in:
@@ -17,7 +17,7 @@ describe('adminNavigation', () => {
|
||||
'供应商中心',
|
||||
'货柜管理',
|
||||
'海外业务',
|
||||
'海外仓库存',
|
||||
'海外仓',
|
||||
'财务管理',
|
||||
'销售管理',
|
||||
'通用',
|
||||
@@ -49,19 +49,20 @@ describe('adminNavigation', () => {
|
||||
'装柜清单',
|
||||
])
|
||||
expect(adminNavigation.find((item) => item.key === 'overseas-inventory')?.children?.map((item) => item.title)).toEqual([
|
||||
'尾程订单',
|
||||
'入库单',
|
||||
'换标单',
|
||||
'出库单',
|
||||
'托盘管理',
|
||||
'箱号管理',
|
||||
'产品库',
|
||||
'退货库存',
|
||||
'暂扣库存',
|
||||
'库存管理',
|
||||
])
|
||||
expect(adminNavigation.find((item) => item.key === 'general')?.children?.map((item) => item.title)).toEqual([
|
||||
'产品信息',
|
||||
'费用项目',
|
||||
'汇率管理',
|
||||
'仓库管理',
|
||||
'海外仓报价',
|
||||
'船期价格表',
|
||||
'车辆列表',
|
||||
'下载中心',
|
||||
@@ -137,6 +138,42 @@ describe('adminNavigation', () => {
|
||||
])
|
||||
})
|
||||
|
||||
it('shows only the confirmed phase-four pages with their list permissions', () => {
|
||||
const filtered = filterAdminNavigation(adminNavigation, new Set([
|
||||
'platform:overseas-warehouse:last-mile-order:list',
|
||||
'platform:overseas-warehouse:inbound-order:list',
|
||||
'platform:overseas-warehouse:relabel-order:list',
|
||||
'platform:overseas-warehouse:pallet:list',
|
||||
'platform:overseas-warehouse:carton:list',
|
||||
'platform:overseas-warehouse:product:list',
|
||||
'platform:overseas-warehouse:inventory:list',
|
||||
'platform:overseas-business:purchase:list',
|
||||
'platform:overseas-business:truck:list',
|
||||
'platform:overseas-business:looseboard:list',
|
||||
'platform:overseas-master-data:exchange-rate:list',
|
||||
'platform:overseas-master-data:quote:list',
|
||||
'platform:overseas-master-data:vehicle:list',
|
||||
]))
|
||||
const paths = getNavigationLeaves(filtered).map((item) => item.path)
|
||||
|
||||
expect(paths).toEqual(expect.arrayContaining([
|
||||
'/overseas-warehouse/last-mile-orders',
|
||||
'/overseas-warehouse/inbound-orders',
|
||||
'/overseas-warehouse/relabel-orders',
|
||||
'/overseas-warehouse/pallets',
|
||||
'/overseas-warehouse/cartons',
|
||||
'/overseas-warehouse/products',
|
||||
'/overseas-warehouse/inventory',
|
||||
'/overseas-business/purchases',
|
||||
'/overseas-business/trucks',
|
||||
'/overseas-business/looseboards',
|
||||
'/overseas-master-data/exchange-rates',
|
||||
'/overseas-master-data/quotes',
|
||||
'/overseas-master-data/vehicles',
|
||||
]))
|
||||
expect(paths.some((path) => path.includes('outbound') || path.includes('delivery'))).toBe(false)
|
||||
})
|
||||
|
||||
it('filters protected pages without mutating the source tree', () => {
|
||||
const sourceSnapshot = JSON.stringify(adminNavigation, (key, value) => key === 'icon' ? '[icon]' : value)
|
||||
const filtered = filterAdminNavigation(adminNavigation, new Set(['platform:permission:list']))
|
||||
|
||||
Reference in New Issue
Block a user