This commit is contained in:
2026-08-14 14:50:44 +08:00
parent a81af4a664
commit 1c1c48f8d3
11 changed files with 116 additions and 23 deletions
@@ -219,6 +219,27 @@ describe('WeightOcrPanel confirmation behavior', () => {
expect(correctWeightResult).not.toHaveBeenCalled()
})
it('emits the latest server total after confirming a weight', async () => {
vi.mocked(getWeightWorkspace)
.mockResolvedValueOnce(workspace)
.mockResolvedValueOnce({
...workspace,
actualGrossWeightKg: 285.5,
weightResults: [{ ...pendingWeight, recognitionStatus: 'CONFIRMED', finalWeightKg: 285.5, version: 1 }],
})
const wrapper = mountPanel()
await flushPromises()
await openWeightDialog(wrapper)
await dialogConfirmButton().trigger('click')
await flushPromises()
expect(wrapper.emitted('summaryChanged')).toEqual([[285.5]])
expect(wrapper.emitted('changed')).toHaveLength(1)
expect(wrapper.text()).toContain('已确认总毛重')
expect(wrapper.text()).toContain('285.500 KG')
})
it('requires explicit image review before confirming a low-confidence OCR value', async () => {
vi.mocked(getWeightWorkspace).mockResolvedValue({
...workspace,