2026-09-06 15:53:56 +08:00
|
|
|
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, /下载关联模板/)
|
|
|
|
|
assert.match(view, /上传关联面单/)
|
|
|
|
|
assert.match(view, /cargoRows\.value = imported\.map/)
|
|
|
|
|
assert.match(view, /totalPackageCount: 1, notifiedPackageCount: 1/)
|
|
|
|
|
assert.doesNotMatch(view, /applyCartonMarkBinding/)
|
|
|
|
|
assert.doesNotMatch(view, /上传SKU 标签/)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('目的仓支持顶部兜底并随每箱明细提交', () => {
|
|
|
|
|
assert.match(api, /destinationWarehouseId\?: string/)
|
|
|
|
|
assert.match(view, /!item\.destinationWarehouseId && !form\.warehouse/)
|
|
|
|
|
assert.match(view, /destinationWarehouseId: item\.destinationWarehouseId \|\| undefined/)
|
|
|
|
|
assert.match(view, /cartonMark: item\.cartonMark/)
|
|
|
|
|
assert.match(view, /fbaCartonMark: item\.fbaCartonMark/)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('贴标明细保留箱唛绑定,不再单独填箱数', () => {
|
|
|
|
|
assert.match(view, /<th>我方箱唛<\/th><th>FBA 箱唛/)
|
|
|
|
|
assert.match(view, /v-model="row\.cartonMark"/)
|
|
|
|
|
assert.match(view, /v-if="props\.service !== 'labeling'">\{\{ props\.service === 'disposal'/)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('商品 SKU 在贴标模板和明细中为选填', () => {
|
|
|
|
|
assert.match(view, /const header = \['商品SKU(选填)'/)
|
|
|
|
|
assert.match(view, /const example = \['', '示例商品'/)
|
|
|
|
|
assert.match(view, /headers\.includes\('商品SKU(选填)'\)/)
|
|
|
|
|
assert.match(view, /const required = \['中文品名', 'FBA货件编号'/)
|
|
|
|
|
assert.match(view, /商品 SKU<span v-if="props\.service !== 'labeling'"> \*<\/span>/)
|
|
|
|
|
assert.match(api, /skuCode\?: string; productNameZh/)
|
|
|
|
|
})
|
2026-09-06 18:11:42 +08:00
|
|
|
|
|
|
|
|
test('贴标申请详情展示逐箱箱唛换标关系', () => {
|
|
|
|
|
assert.match(api, /export interface RelabelDetail/)
|
|
|
|
|
assert.match(api, /return overseasApiRequest<RelabelDetail>/)
|
|
|
|
|
assert.match(view, /<h3>箱唛换标明细<\/h3>/)
|
|
|
|
|
assert.match(view, /item\.cartonMark \|\| '—'/)
|
|
|
|
|
assert.match(view, /item\.fbaCartonMark \|\| '—'/)
|
|
|
|
|
assert.match(view, /item\.shipmentNo \|\| '—'/)
|
|
|
|
|
assert.match(view, /item\.newSkuCode \|\| '—'/)
|
|
|
|
|
})
|