From 41924a438c0897f84141a989d94b7fedc302bd69 Mon Sep 17 00:00:00 2001 From: ouyangxq <775153912@qq.com> Date: Wed, 9 Sep 2026 13:33:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../container-loading/pages/ContainersView.test.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/modules/container-loading/pages/ContainersView.test.ts b/src/modules/container-loading/pages/ContainersView.test.ts index 9675af1d..b61f729e 100644 --- a/src/modules/container-loading/pages/ContainersView.test.ts +++ b/src/modules/container-loading/pages/ContainersView.test.ts @@ -88,7 +88,14 @@ describe('ContainersView', () => { expect(wrapper.text()).not.toContain('报空预警') }) - it('shows one direct empty-return action only when permission and server actions allow it', async () => { + it.each([3, 0])('submits direct empty return with server version %s, including unload without pickup', async (version) => { + const original = await listContainers({ page: 1, size: 20 }, 'OVERSEAS') + vi.mocked(listContainers).mockClear().mockResolvedValue({ ...original, records: original.records.map((row) => ({ + ...row, + terminalDrayage: { ...drayage, version, actualPickupAt: version ? drayage.actualPickupAt : null, + fleetSupplierId: version ? drayage.fleetSupplierId : null, allowedActions: ['RECORD_EMPTY_RETURN'], + emptyReturnWarning: { status: 'PENDING', deadlineAt: drayage.estimatedEmptyReturnAt, overdueHours: 0, overdueDays: 0 } }, + })) }) const wrapper = await mountOverseasRoute() expect(listContainers).toHaveBeenCalledWith(expect.objectContaining({ scope: 'ACTIVE' }), 'OVERSEAS') const buttons = wrapper.findAll('button').filter((item) => item.text().includes('确认还柜')) @@ -105,7 +112,7 @@ describe('ContainersView', () => { confirm.click() await flushPromises() expect(recordTerminalDrayageEmptyReturn).toHaveBeenCalledTimes(1) - expect(recordTerminalDrayageEmptyReturn).toHaveBeenCalledWith('9001', { expectedVersion: 3, actualAt: '2026-09-11T13:00:00', remark: '还柜凭证已核对' }) + expect(recordTerminalDrayageEmptyReturn).toHaveBeenCalledWith('9001', { expectedVersion: version, actualAt: '2026-09-11T13:00:00', remark: '还柜凭证已核对' }) expect(wrapper.text()).toContain('已还柜') expect(listContainers).toHaveBeenCalledTimes(callsBefore + 1) expect(wrapper.findAll('.row-actions button').some((button) => button.text() === '确认还柜')).toBe(false)