优化
This commit is contained in:
@@ -67,7 +67,7 @@ test('final photo upload waits for explicit confirmation and failed uploads cann
|
||||
assert.equal(requests.length, 0)
|
||||
await page.confirmReceipt()
|
||||
assert.equal(requests.length, failUpload ? 0 : 1)
|
||||
if (failUpload) assert.match(page.error.message, /照片/)
|
||||
if (failUpload) assert.equal(page.error.message, 'upload failed')
|
||||
}
|
||||
})
|
||||
|
||||
@@ -96,13 +96,23 @@ test('parcel photos accumulate without submitting until explicit receipt confirm
|
||||
assert.equal(page.current, null)
|
||||
})
|
||||
|
||||
test('parcel signing requires a photo even for a partial receipt', async () => {
|
||||
let requests = 0
|
||||
const page = setup(async () => { requests++; return {} })
|
||||
page.unitType = 'PARCEL'; page.boxRows = [physicalRow({ 'SKU-TEST': 2 })]
|
||||
await page.confirmReceipt()
|
||||
assert.equal(requests, 0)
|
||||
assert.match(page.error.message, /照片/)
|
||||
test('missing receipt photos show a reminder without submitting or adding a page error', async () => {
|
||||
for (const type of ['BOX', 'PARCEL', 'PALLET']) {
|
||||
let requests = 0
|
||||
const modals = []
|
||||
const page = setup(async () => { requests++; return {} }, new Map(), 'operator:warehouse', {
|
||||
uni: { showModal: options => modals.push(options) }
|
||||
})
|
||||
page.unitType = type; page.boxRows = [physicalRow({ 'SKU-TEST': 10 })]
|
||||
page.quantity = () => 10; page.remaining = () => 10
|
||||
await page.confirmReceipt()
|
||||
assert.equal(requests, 0)
|
||||
assert.equal(modals.length, 1)
|
||||
assert.match(modals[0].content, /照片/)
|
||||
assert.equal(modals[0].showCancel, false)
|
||||
assert.equal(page.error, undefined)
|
||||
assert.ok(page.current)
|
||||
}
|
||||
})
|
||||
|
||||
test('editing the draft before the camera returns prevents late photo submission', async () => {
|
||||
@@ -123,7 +133,7 @@ function setup(confirm, saved = new Map(), scope = 'operator:warehouse', runtime
|
||||
const context = vm.createContext({ reactive: value => value, ReturnLabelConfirmation: {}, PortalHeader: {}, ScanTargetInput: {}, ExceptionReturnWork: {},
|
||||
playSuccessSound() {}, playErrorSound() {}, confirmReturnReceipt: confirm,
|
||||
...runtime,
|
||||
uni: { setStorageSync: (key, value) => saved.set(key, structuredClone(value)), getStorageSync: key => saved.get(key), removeStorageSync: key => saved.delete(key), ...runtime.uni } })
|
||||
uni: { showModal() {}, setStorageSync: (key, value) => saved.set(key, structuredClone(value)), getStorageSync: key => saved.get(key), removeStorageSync: key => saved.delete(key), ...runtime.uni } })
|
||||
const store = readFileSync(new URL('../src/stores/warehouse-work.js', import.meta.url), 'utf8')
|
||||
vm.runInContext(store.replace(/^import .*$/mg, '').replace(/export /g, ''), context)
|
||||
const page = readFileSync(new URL('../src/pages/return-receipt/return-receipt.vue', import.meta.url), 'utf8')
|
||||
|
||||
Reference in New Issue
Block a user