优化
This commit is contained in:
@@ -382,9 +382,24 @@ describe('InboundMeasurementPanel', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('does not submit a second count update when the full draft already saved the changed count', async () => {
|
||||
const wrapper = await mountPanel()
|
||||
await wrapper.find('.measurement-count-editor input').setValue('9')
|
||||
await wrapper.find('input[aria-label="仓库修改外箱长"]').setValue('55')
|
||||
const save = wrapper.findAll('button').find((button) => button.text().includes('保存测量数据'))
|
||||
await save?.trigger('click')
|
||||
await flushPromises()
|
||||
|
||||
expect(saveInboundMeasurementDraft).toHaveBeenCalledWith('10001', '7001', expect.objectContaining({
|
||||
version: 2,
|
||||
items: [expect.objectContaining({ packageCount: 9, outerLengthCm: 55 })],
|
||||
}))
|
||||
expect(updateConfirmedPackageCount).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('preserves the edited form when the backend reports a version conflict', async () => {
|
||||
vi.mocked(updateConfirmedPackageCount).mockRejectedValueOnce(
|
||||
new ApiResponseError('数据版本已变化,请刷新后重试', 'A0409', 200, null, 'req-conflict', 'trace-conflict'),
|
||||
new ApiResponseError('测量数据已被其他人修改,请刷新后重试', 'A0409', 200, null, 'req-conflict', 'trace-conflict'),
|
||||
)
|
||||
const wrapper = await mountPanel()
|
||||
const countInput = wrapper.find('.measurement-count-editor input')
|
||||
|
||||
Reference in New Issue
Block a user