Merge branch 'release/test' of http://8.163.30.128:10082/html/client-web into release/test

This commit is contained in:
2026-10-16 11:43:01 +08:00
13 changed files with 139 additions and 11 deletions
@@ -1,6 +1,7 @@
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
import ts from 'typescript'
const view = readFileSync(new URL('./ReturnOrdersView.vue', import.meta.url), 'utf8')
const api = readFileSync(new URL('../api/returnOrders.ts', import.meta.url), 'utf8')
@@ -254,7 +255,25 @@ test('待审核退货可编辑,完成入库后从独立新增页发起贴标',
assert.match(view, /name: 'overseas-labeling-create'/)
assert.match(view, /query: \{ returnNo: order\.returnNo, warehouseId: String\(order\.overseasWarehouseId\)/)
assert.match(view, /cartonMark \? \{ cartonMark \}/)
assert.match(view, /openRelabel\(selected\.order, current\.carton\.cartonMark\)/)
assert.match(view, /v-if="canCreateRelabel && canApplyRelabel\(selected\.order\)"[^>]*@click="openRelabel\(selected\.order\)">贴标申请/)
assert.match(view, /v-for="application in row\.relabelApplications \|\| \[\]"/)
assert.match(view, /relabelStatusLabel\(application\.status\)/)
})
test('贴标入口保留完成入库门禁与退货来源,箱号只作为目标页库存筛选', () => {
const source = view.slice(view.indexOf('function canApplyRelabel('), view.indexOf('async function submit()'))
const javascript = ts.transpileModule(source, { compilerOptions: { target: ts.ScriptTarget.ES2022 } }).outputText
const routes = []
const { canApplyRelabel, openRelabel } = new Function('router', `${javascript}; return { canApplyRelabel, openRelabel }`)({ push: route => routes.push(route) })
const order = { returnNo: 'RT-TEST', overseasWarehouseId: 'WH-TEST', status: 'COMPLETED', needRelabel: true }
assert.equal(canApplyRelabel(order), true)
assert.equal(canApplyRelabel({ ...order, status: 'PENDING_RECEIPT' }), false)
assert.equal(canApplyRelabel({ ...order, needRelabel: false }), false)
assert.equal(canApplyRelabel({ ...order, relabelNo: 'RL-EXISTS' }), false)
openRelabel(order)
openRelabel(order, 'RC-TEST')
assert.deepEqual(routes, [
{ name: 'overseas-labeling-create', query: { returnNo: 'RT-TEST', warehouseId: 'WH-TEST' } },
{ name: 'overseas-labeling-create', query: { returnNo: 'RT-TEST', warehouseId: 'WH-TEST', cartonMark: 'RC-TEST' } },
])
})