修复订单货柜预约与排车维护界面

This commit is contained in:
2026-10-21 23:20:10 +08:00
parent 93a31b3872
commit 2e26477db5
68 changed files with 602 additions and 239 deletions
@@ -14,6 +14,18 @@ const detailResponse = (version = 0, status = 'DRAFT') => ({
})
describe('ocean bookings api', () => {
it('preserves the backend history creation timestamp when normalizing a detail response', async () => {
const createdAt = '2026-10-20T09:12:34'
const post = vi.spyOn(http, 'post').mockResolvedValue({ code: '200', data: {
...detailResponse(),
histories: [{ id: '9007199254740999', fromStatus: null, toStatus: 'DRAFT', action: 'CREATE', operatorName: '创建人', createdAt }],
} })
const result = await createOceanBooking({ expectedVersion: 0, data: { customerId: null, customerName: null, channelCode: null, warehouseId: null, billOfLadingNo: '', vesselName: '', voyageNo: '', estimatedSailingAt: null, estimatedArrivalAt: null, parties: [], containerRequirements: [] } })
expect(post).toHaveBeenCalledOnce()
expect(result.histories[0]).toMatchObject({ id: '9007199254740999', action: 'CREATE', createdAt })
expect(result.statusHistory).toEqual(result.histories)
})
it('normalizes pagination and long ids', async () => {
vi.spyOn(http, 'get').mockResolvedValueOnce({ code: '200', message: 'ok', data: { records: [{ id: 123, bookingNo: 'OB-260825-0183', customerId: 456, shipperName: '发货企业', consigneeName: '收货企业', containerCount: '1' }], page: '2', size: '20', total: '21', pages: '2' } })
const result = await listOceanBookings({ page: 1, size: 10 })