This commit is contained in:
2026-09-24 08:55:38 +08:00
parent 50dbbcaa6e
commit bc9fa0faa3
8 changed files with 107 additions and 15 deletions
+27
View File
@@ -30,3 +30,30 @@ test('cancel stays on list and preserves existing task selection', async () => {
assert.equal(context.taskCode, 'PREVIOUS')
assert.equal(context.busy, false)
})
test('new relabel task asks whether to start before it can be claimed', async () => {
const calls = []
const uni = { showModal(options) { calls.push(options); options.success({ confirm: false }) } }
const component = new Function('PortalHeader', 'RelabelPalletWork', 'ScanTargetInput', 'uni', body)({}, {}, {}, uni)
const context = { busy: false }
const confirmed = await component.methods.confirmStartTask.call(context, { relabelNo: 'RL-NEW' })
assert.equal(confirmed, false)
assert.equal(calls[0].title, '开始贴标作业')
assert.match(calls[0].content, /是否开始贴标作业/)
assert.match(calls[0].content, /RL-NEW/)
assert.equal(calls[0].confirmText, '是')
assert.equal(calls[0].cancelText, '否')
assert.equal(context.busy, false)
})
test('start confirmation gates task selection and claim', () => {
const start = source.indexOf('const confirmed = await this.confirmStartTask(item)')
const selection = source.indexOf('this.taskCode = item.relabelNo', start)
const claim = source.indexOf("warehouseIdempotencyKey('relabel', 'claim', payload)", start)
assert.ok(start >= 0)
assert.ok(selection > start)
assert.ok(claim > selection)
assert.match(source.slice(start, selection), /if \(!confirmed\) return/)
})