优化
This commit is contained in:
@@ -88,7 +88,14 @@ describe('ContainersView', () => {
|
|||||||
expect(wrapper.text()).not.toContain('报空预警')
|
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()
|
const wrapper = await mountOverseasRoute()
|
||||||
expect(listContainers).toHaveBeenCalledWith(expect.objectContaining({ scope: 'ACTIVE' }), 'OVERSEAS')
|
expect(listContainers).toHaveBeenCalledWith(expect.objectContaining({ scope: 'ACTIVE' }), 'OVERSEAS')
|
||||||
const buttons = wrapper.findAll('button').filter((item) => item.text().includes('确认还柜'))
|
const buttons = wrapper.findAll('button').filter((item) => item.text().includes('确认还柜'))
|
||||||
@@ -105,7 +112,7 @@ describe('ContainersView', () => {
|
|||||||
confirm.click()
|
confirm.click()
|
||||||
await flushPromises()
|
await flushPromises()
|
||||||
expect(recordTerminalDrayageEmptyReturn).toHaveBeenCalledTimes(1)
|
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(wrapper.text()).toContain('已还柜')
|
||||||
expect(listContainers).toHaveBeenCalledTimes(callsBefore + 1)
|
expect(listContainers).toHaveBeenCalledTimes(callsBefore + 1)
|
||||||
expect(wrapper.findAll('.row-actions button').some((button) => button.text() === '确认还柜')).toBe(false)
|
expect(wrapper.findAll('.row-actions button').some((button) => button.text() === '确认还柜')).toBe(false)
|
||||||
|
|||||||
Reference in New Issue
Block a user