39 lines
1.8 KiB
JavaScript
39 lines
1.8 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, /下载关联模板/)
|
||
|
|
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/)
|
||
|
|
})
|