import assert from 'node:assert/strict' import { readFileSync } from 'node:fs' 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'/) assert.match(api, /\/merchant\/v1\/last-leg\/inbound-plans/) assert.match(api, /encodeURIComponent\(planNo\)/) assert.doesNotMatch(api, /\/platform\/|\/internal\/|customerId|tenantId/) }) test('keeps actions first and exposes filters loading errors empty state pagination and business identifiers', () => { assert.match(view, /]*fixed="left"/) for (const token of ['planNo', 'inboundCode', 'destinationWarehouseCode', 'appointmentStatus', 'dispatchStatus', 'createdDates']) assert.match(view, new RegExp(token)) assert.match(view, /v-loading="loading"/) assert.match(view, /type="error"/) assert.match(view, /empty-text="暂无入库订单"/) assert.match(view, / { 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/) })