优化
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { overseasHttp } from '@/shared/api/overseasHttp'
|
||||
import { convertLastMileContainerToInboundPlans, convertLastMileOrderToInboundPlan, getLastMileOrder, listLastMileOrders, listPendingContainerSummaries, transferLastMileOrders } from './lastMileOrders'
|
||||
import { convertLastMileContainerToInboundPlans, convertLastMileOrderToInboundPlan, getContainerPlanProgress, getLastMileOrder, listContainerPlanProgress, listLastMileOrders, transferLastMileOrders } from './lastMileOrders'
|
||||
|
||||
vi.mock('@/shared/api/overseasHttp', () => ({ overseasHttp: { get: vi.fn(), put: vi.fn(), post: vi.fn() } }))
|
||||
|
||||
@@ -69,16 +69,16 @@ describe('last-mile order overseas API', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('loads server-side pending container summaries with pagination and filters', async () => {
|
||||
it('loads server-side container progress with pagination and filters', async () => {
|
||||
const record = {
|
||||
sourceContainerBookingId: '2092873463568597001', containerNo: 'CONT-15', orderCount: 15,
|
||||
inboundCodeCount: 15, customerCount: 3, totalPackageCount: 150, totalPalletCount: 30,
|
||||
totalVolumeCbm: 45.5, eligible: true,
|
||||
sourceContainerBookingId: '2092873463568597001', containerNo: 'CONT-15', totalOrderCount: 15,
|
||||
inboundCodeCount: 13, missingInboundCodeCount: 2, planCount: 10, plannedInboundCodeCount: 10,
|
||||
pendingPlanCount: 5, plannedArrivalAt: '2026-09-01T08:00:00', allPlansReady: false, blockingReason: '存在2票缺少入仓码',
|
||||
}
|
||||
vi.mocked(overseasHttp.get).mockResolvedValue({
|
||||
code: '200', message: 'success', data: { records: [record], page: '2', size: '10', total: '21', pages: '3' },
|
||||
})
|
||||
await expect(listPendingContainerSummaries({
|
||||
await expect(listContainerPlanProgress({
|
||||
page: 2, size: 10, containerNo: 'CONT-15',
|
||||
createdFrom: '2026-08-01T00:00:00', createdTo: '2026-08-31T23:59:59',
|
||||
})).resolves.toEqual({ records: [record], page: 2, size: 10, total: 21, pages: 3 })
|
||||
@@ -89,4 +89,11 @@ describe('last-mile order overseas API', () => {
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
it('loads one container detail with the encoded stable long id', async () => {
|
||||
const detail = { summary: { sourceContainerBookingId: '2092873463568597001' }, orders: [] }
|
||||
vi.mocked(overseasHttp.get).mockResolvedValue({ code: '200', message: 'success', data: detail })
|
||||
await expect(getContainerPlanProgress('2092873463568597001/unsafe')).resolves.toEqual(detail)
|
||||
expect(overseasHttp.get).toHaveBeenCalledWith('/platform/v1/last-leg/orders/container-summaries/2092873463568597001%2Funsafe')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user