feat(appointment): integrate work calendar and original business actions
This commit is contained in:
@@ -9,7 +9,24 @@ import {
|
||||
recordTerminalDrayageEmptyReturn,
|
||||
scheduleTerminalDrayagePickup,
|
||||
selectTerminalDrayageFleet,
|
||||
getDirectDeliveries, recordDirectDelivery, recordTerminalPickup,
|
||||
} from './terminalDrayages'
|
||||
it('records only the original actual PICKED_UP node with an immutable observed time and idempotency header', async () => {
|
||||
const command = { standardNode: 'PICKED_UP' as const, observedAt: '2026-10-15T09:00:00', estimatedAt: null, actualAt: '2026-10-14T23:00:00', locationCode: 'TEST-PORT', locationName: '测试码头', reason: '司机确认已提柜' }
|
||||
vi.mocked(http.post).mockResolvedValue({ data: {} })
|
||||
await recordTerminalPickup('9007199254740993', command, 'same-pickup-key')
|
||||
expect(http.post).toHaveBeenCalledWith('/platform/v1/container-shipping-nodes/9007199254740993', command, { headers: { 'Idempotency-Key': 'same-pickup-key' } })
|
||||
})
|
||||
|
||||
it('uses the actual direct-delivery source and stable idempotency key without coercing long IDs', async () => {
|
||||
vi.mocked(http.get).mockResolvedValue({ data: [] }); await getDirectDeliveries('9007199254740993')
|
||||
expect(http.get).toHaveBeenCalledWith('/platform/v1/terminal-drayages/9007199254740993/direct-deliveries')
|
||||
const request = { expectedVersion: 0, actualAt: '2026-10-16T01:00:00', timezone: 'America/Los_Angeles', receivedBy: '测试签收人', evidenceNo: 'POD-001', remark: null }
|
||||
vi.mocked(http.post).mockResolvedValue({ data: { requirementKey: 'INBOUND:9007199254740999', version: 1 } })
|
||||
await recordDirectDelivery('9007199254740993', 'INBOUND:9007199254740999', request, 'retry-same-key')
|
||||
expect(http.post).toHaveBeenCalledWith('/platform/v1/terminal-drayages/9007199254740993/direct-deliveries/9007199254740999', request, { headers: { 'Idempotency-Key': 'retry-same-key' } })
|
||||
await expect(recordDirectDelivery('1', 'ORDER:1', request, 'bad')).rejects.toThrow('标识无效')
|
||||
})
|
||||
|
||||
vi.mock('@/shared/api/http', () => ({
|
||||
http: { get: vi.fn(), post: vi.fn() },
|
||||
|
||||
Reference in New Issue
Block a user