This commit is contained in:
2026-09-07 15:07:49 +08:00
parent 658b2e84cf
commit 7e596b8d77
5 changed files with 41 additions and 6 deletions
@@ -5,6 +5,7 @@ import test from 'node:test'
const api = readFileSync(new URL('./api/inboundPlans.ts', import.meta.url), 'utf8')
const routes = readFileSync(new URL('./routes.ts', import.meta.url), 'utf8')
const view = readFileSync(new URL('./views/InboundOrdersView.vue', import.meta.url), 'utf8')
const overseasHttp = readFileSync(new URL('../../api/overseasHttp.ts', import.meta.url), 'utf8')
test('activates the customer-scoped overseas inbound list and detail', () => {
assert.match(routes, /path: 'orders\/inbound'[\s\S]*?release: 'active'[\s\S]*?permission: 'merchant:warehouse:inbound:list'/)
@@ -23,3 +24,21 @@ test('keeps actions first and exposes filters loading errors empty state paginat
assert.match(view, /detail\.planNo/)
assert.doesNotMatch(view, /planId|orderId|warehouseId|customerId/)
})
test('shows only the server-provided overseas receiving warehouse code and name', () => {
assert.match(api, /overseasWarehouseCode: string \| null/)
assert.match(api, /overseasWarehouseName: string \| null/)
assert.doesNotMatch(api, /overseasWarehouseId/)
assert.match(view, /label="海外接柜仓"/)
assert.match(view, /overseasWarehouseLabel\(scope\.row\.overseasWarehouseCode, scope\.row\.overseasWarehouseName\)/)
assert.match(view, /overseasWarehouseLabel\(detail\.overseasWarehouseCode, detail\.overseasWarehouseName\)/)
assert.match(view, /if \(typeof code !== 'string' \|\| !code\.trim\(\) \|\| typeof name !== 'string' \|\| !name\.trim\(\)\) return '—'/)
assert.doesNotMatch(view, /warehouseName \|\| warehouseCode|destinationWarehouse(?:Id|Code|Name).*overseasWarehouse/i)
})
test('preserves overseas API diagnostic metadata without rendering it as a business identifier', () => {
assert.match(overseasHttp, /response\.data\.traceId/)
assert.match(overseasHttp, /response\.data\.requestId/)
assert.match(overseasHttp, /body\.traceId, body\.requestId/)
assert.doesNotMatch(view, /requestId|traceId/)
})