优化
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { overseasWarehouseRoutes } from './routes'
|
||||
import { overseasWarehousePermissions as permission } from './permissions'
|
||||
|
||||
describe('overseas warehouse routes', () => {
|
||||
it('uses list permission for each list and read-only detail route', () => {
|
||||
expect(overseasWarehouseRoutes.map((route) => [route.path, route.meta.permission])).toEqual([
|
||||
['overseas-warehouse/last-mile-orders', permission.lastMileOrderList],
|
||||
['overseas-warehouse/last-mile-orders/:orderId', permission.lastMileOrderList],
|
||||
['overseas-warehouse/inbound-orders', permission.inboundOrderList],
|
||||
['overseas-warehouse/inbound-orders/:orderId', permission.inboundOrderList],
|
||||
['overseas-warehouse/inventory', permission.inventoryList],
|
||||
['overseas-warehouse/inventory-transactions', permission.inventoryList],
|
||||
['overseas-warehouse/inventory/:inventoryId', permission.inventoryList],
|
||||
['overseas-warehouse/relabel-orders', permission.relabelOrderList],
|
||||
['overseas-warehouse/relabel-orders/:orderId', permission.relabelOrderList],
|
||||
['overseas-warehouse/pallets', permission.palletList],
|
||||
['overseas-warehouse/pallets/:palletId', permission.palletList],
|
||||
['overseas-warehouse/cartons', permission.cartonList],
|
||||
['overseas-warehouse/cartons/:cartonId', permission.cartonList],
|
||||
['overseas-warehouse/products', permission.productList],
|
||||
['overseas-warehouse/products/:productId', permission.productList],
|
||||
])
|
||||
})
|
||||
|
||||
it('keeps all details as formal parameterized pages', () => {
|
||||
const details = overseasWarehouseRoutes.filter((route) => route.path.includes('/:'))
|
||||
expect(details).toHaveLength(7)
|
||||
expect(details.every((route) => route.meta.showPageHeading === false)).toBe(true)
|
||||
})
|
||||
|
||||
it('keeps create and edit permissions independent for second-batch resources', () => {
|
||||
expect(new Set([
|
||||
permission.relabelOrderCreate, permission.relabelOrderEdit,
|
||||
permission.palletCreate, permission.palletEdit,
|
||||
permission.cartonCreate, permission.cartonEdit,
|
||||
permission.productCreate, permission.productEdit,
|
||||
]).size).toBe(8)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user