fix(dispatch): 拣货拍照分区并展示有效预约审核依据

This commit is contained in:
2026-10-21 19:44:32 +08:00
parent a181239cbf
commit 92ea409ce5
6 changed files with 131 additions and 29 deletions
+12
View File
@@ -55,6 +55,18 @@ test('a failed upload does not replace a saved photo or advance the stage', asyn
assert.ok(state.pending.key); assert.equal(state.pending.photo, undefined)
})
test('definitive file rejection allows selecting a new image while retaining the saved one', async () => {
let uploads = 0
const { state } = component({ getLoadingDocuments: async () => data({ photos: [photo] }), uploadLoadingPhoto: async () => {
if (++uploads === 1) throw { code: 'A0400', message: '图片内容无效' }
return photo
} })
await state.load(); await state.choose('LOADING_SCENE')
assert.equal(state.pending, null); assert.equal(state.snapshot.photos[0].fileId, photo.fileId)
assert.equal(state.error.message, '图片内容无效')
await state.choose('LOADING_SCENE'); assert.equal(uploads, 2); assert.equal(state.pending, null)
})
test('loading documents can be saved during LOADING without claiming departure', async () => {
assert.equal(normalizeLoadingDocuments(data({ stage: 'LOADING' }), 'PC/1').stage, 'LOADING')
assert.throws(() => normalizeLoadingDocuments(data({ stage: 'BEFORE_LOADING' }), 'PC/1'), /不一致/)