61 lines
3.4 KiB
TypeScript
61 lines
3.4 KiB
TypeScript
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/cargo-discards', permission.discardList],
|
|
['overseas-warehouse/inbound-orders/:orderId', permission.inboundOrderList],
|
|
['overseas-warehouse/dispatches', permission.dispatchList],
|
|
['overseas-warehouse/dispatches/:dispatchNo', permission.dispatchList],
|
|
['overseas-warehouse/outbounds', permission.outboundList],
|
|
['overseas-warehouse/outbounds/:outboundNo', permission.outboundList],
|
|
['overseas-warehouse/delivery-orders', permission.deliveryList],
|
|
['overseas-warehouse/delivery-orders/:deliveryNo', permission.deliveryList],
|
|
['overseas-warehouse/exception-orders', permission.exceptionOrderList],
|
|
['overseas-warehouse/customer-visits', permission.customerVisitList],
|
|
['overseas-warehouse/inventory', permission.inventoryList],
|
|
['overseas-warehouse/return-inventory', permission.returnInventoryList],
|
|
['overseas-warehouse/return-cartons', permission.returnCartonsList],
|
|
['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/locations', permission.locationList],
|
|
['general/mojia-sku-sync', permission.mojiaSkuSyncList],
|
|
])
|
|
})
|
|
|
|
it('keeps all details as formal parameterized pages', () => {
|
|
const details = overseasWarehouseRoutes.filter((route) => route.path.includes('/:'))
|
|
expect(details).toHaveLength(8)
|
|
expect(details.every((route) => route.meta.showPageHeading === false)).toBe(true)
|
|
})
|
|
|
|
it('keeps deferred carton and product page sources outside the formal route set', () => {
|
|
const paths = overseasWarehouseRoutes.map((route) => route.path)
|
|
expect(paths.some((path) => path.includes('/cartons'))).toBe(false)
|
|
expect(paths.some((path) => path.includes('/products'))).toBe(false)
|
|
})
|
|
|
|
it('retains independent write permissions for current and deferred page sources', () => {
|
|
expect(new Set([
|
|
permission.relabelOrderCreate, permission.relabelOrderStatus,
|
|
permission.palletCreate, permission.palletEdit,
|
|
permission.cartonCreate, permission.cartonEdit,
|
|
permission.productCreate, permission.productEdit,
|
|
permission.exceptionOrderCreate, permission.deliveryReturn, permission.deliveryStatus,
|
|
permission.customerVisitEdit,
|
|
permission.dispatchEdit, permission.dispatchCancel, permission.dispatchTransferDelivery,
|
|
permission.outboundCancel, permission.outboundCreate,
|
|
permission.warehouseTransferApprove,
|
|
]).size).toBe(18)
|
|
})
|
|
})
|