79 lines
4.2 KiB
JavaScript
79 lines
4.2 KiB
JavaScript
import assert from 'node:assert/strict'
|
|
import { readFileSync } from 'node:fs'
|
|
import test from 'node:test'
|
|
|
|
const view = readFileSync(new URL('./WarehouseServiceView.vue', import.meta.url), 'utf8')
|
|
const api = readFileSync(new URL('../api/warehouseServices.ts', import.meta.url), 'utf8')
|
|
|
|
test('仓储转运先选择入仓方式并按方式切换地址信息', () => {
|
|
assert.match(view, /value="WAREHOUSE_PICKUP">仓库上门提货/)
|
|
assert.match(view, /value="CUSTOMER_DELIVERY">客户送货到仓/)
|
|
assert.match(view, /form\.deliveryMethod === 'WAREHOUSE_PICKUP'.*提货地址/s)
|
|
assert.match(view, /form\.deliveryMethod === 'CUSTOMER_DELIVERY'.*送货地址.*收货联系人.*联系电话/s)
|
|
assert.match(view, /getMerchantWarehouseDetail\(form\.warehouse\)/)
|
|
})
|
|
|
|
test('仓储转运允许暂未确定 FBA 去向并显式选择是否换标', () => {
|
|
assert.match(view, /是否已有 FBA 去向/)
|
|
assert.match(view, /:value="false">暂未确定/)
|
|
assert.match(view, /transferHasFbaDestination.*目的 FBA 仓/s)
|
|
assert.match(view, /是否需要换标/)
|
|
assert.match(view, /:value="false">不需要换标/)
|
|
assert.match(view, /:value="true">需要换标/)
|
|
assert.match(api, /fbaWarehouseCode\?: string/)
|
|
assert.match(api, /fbaShipmentNo\?: string/)
|
|
})
|
|
|
|
test('仓储转运不要求客户填写内部入仓号和我方箱唛,但换标时填写客户箱唛', () => {
|
|
const transferConfig = view.match(/transfer:\s*\{[^\n]+/)?.[0] || ''
|
|
const transferSubmit = view.match(/await createTransfer\(\{[^\n]+/)?.[0] || ''
|
|
assert.doesNotMatch(transferConfig, /进仓编号/)
|
|
assert.doesNotMatch(transferSubmit, /inboundCode|sourceLastlegOrderIds/)
|
|
assert.match(view, /货物明细/)
|
|
assert.match(view, /客户只填写自己的箱唛,我方箱唛由系统生成/)
|
|
assert.match(view, /downloadTransferCartonMarkTemplate/)
|
|
assert.match(view, /importTransferCartonMarks/)
|
|
assert.match(view, /下载 SKU 关联模板/)
|
|
assert.match(view, /上传 SKU 关联/)
|
|
assert.match(view, /下载箱号关联模板/)
|
|
assert.match(view, /上传箱号关联/)
|
|
assert.match(view, /下载 SKU 混箱模板/)
|
|
assert.match(view, /上传 SKU 混箱/)
|
|
assert.match(view, /换标类型/)
|
|
assert.match(view, /v-if="labelingMode === 'carton'"/)
|
|
assert.match(view, /v-else-if="labelingMode === 'sku'"/)
|
|
assert.match(view, /v-else class="warehouse-table-scroll"/)
|
|
assert.match(view, /添加 SKU 明细/)
|
|
assert.match(view, /绑定明细/)
|
|
assert.match(view, /旧 SKU \*.*新 SKU \*.*换标数量(件)\*.*新 FBA 箱唛 \*.*FBA 目的仓 \*/)
|
|
assert.match(transferSubmit, /fbaBoxNos: customerCartonMarks/)
|
|
assert.match(transferSubmit, /shippingMark: transferCustomerMarks\(item\)/)
|
|
assert.match(transferSubmit, /relabelItems: form\.relabel/)
|
|
assert.match(view, /props\.service === 'disposal' \? '本次废弃箱数' : '预计箱数'/)
|
|
assert.doesNotMatch(view, /props\.service === 'transfer'.*FNSKU \/ 箱唛/)
|
|
})
|
|
|
|
test('上门提货不提交物流号,需要换标时随转运单登记申请', () => {
|
|
assert.match(view, /trackingNo:\s*form\.deliveryMethod === 'CUSTOMER_DELIVERY'\s*\?[^:]+:\s*undefined/)
|
|
assert.match(view, /本次提交将同时登记换标申请/)
|
|
assert.match(view, /form\.deliveryMethod === 'CUSTOMER_DELIVERY'.*物流跟踪号/s)
|
|
assert.match(view, /提货联系人/)
|
|
assert.match(view, /联系人电话/)
|
|
assert.match(view, /提货联系人/)
|
|
})
|
|
|
|
test('仓储转运列表操作仓使用海外仓接口数据', () => {
|
|
assert.match(view, /loadAllWarehouseRecords\('OVERSEAS', \(query\) => getMerchantWarehouses\(\{ page: query\.page, size: query\.size \}\)\)/)
|
|
assert.match(view, /\['OVERSEAS', 'OVERSEAS_PARTNER'\]/)
|
|
assert.match(view, /v-for="warehouse in \(props\.service === 'relabel' \? fbaWarehouses : operationWarehouses\)"/)
|
|
assert.doesNotMatch(view, /美西洛杉矶仓/)
|
|
})
|
|
|
|
test('仓储转运填写预计发货时间并只读展示实际发货时间', () => {
|
|
assert.match(view, /预计发货时间/)
|
|
assert.match(view, /v-model="form\.estimatedShipAt"/)
|
|
assert.match(view, /estimatedShipAt: form\.estimatedShipAt/)
|
|
assert.match(view, /实际发货时间由仓库出库或 PDA 完成后回填/)
|
|
assert.match(api, /estimatedShipAt\?: string/)
|
|
})
|