优化
This commit is contained in:
@@ -4,7 +4,7 @@ import { http } from '@/shared/api/http'
|
||||
|
||||
const detailResponse = (version = 0, status = 'CONFIRMED') => ({
|
||||
oceanBooking: {
|
||||
id: 123, bookingNo: 'OB123', status, version, customerId: 456, customerName: '客户',
|
||||
id: 123, bookingNo: 'OB123', status, version, customerId: 456, customerName: '客户', shipperName: '发货企业', consigneeName: '收货企业', containerCount: '2',
|
||||
},
|
||||
parties: [],
|
||||
containers: [{ containerBookingId: 9007199254740993, cabinetNo: 'CAB-1', containerNo: 'MSCU1234567', requirementId: 9007199254740994, allocationId: 9007199254740995, containerType: '40HC', containerKind: 'FCL', capacityCbm: 76, maxWeightKg: 28000, warehouseId: 9007199254740996, warehouseName: '义乌仓', channelCode: 'SEA', channelName: '海运', customerId: 456, customerName: '客户' }],
|
||||
@@ -13,12 +13,13 @@ const detailResponse = (version = 0, status = 'CONFIRMED') => ({
|
||||
|
||||
describe('ocean bookings api', () => {
|
||||
it('normalizes pagination and long ids', async () => {
|
||||
vi.spyOn(http, 'get').mockResolvedValueOnce({ code: '200', message: 'ok', data: { records: [{ id: 123, customerId: 456, containers: [] }], page: '2', size: '20', total: '21', pages: '2' } })
|
||||
vi.spyOn(http, 'get').mockResolvedValueOnce({ code: '200', message: 'ok', data: { records: [{ id: 123, customerId: 456, shipperName: '发货企业', consigneeName: '收货企业', containerCount: '3' }], page: '2', size: '20', total: '21', pages: '2' } })
|
||||
const result = await listOceanBookings({ page: 1, size: 10 })
|
||||
expect(result.page).toBe(2)
|
||||
expect(result.total).toBe(21)
|
||||
expect(result.records[0]?.id).toBe('123')
|
||||
expect(result.records[0]?.customerId).toBe('456')
|
||||
expect(result.records[0]).toMatchObject({ shipperName: '发货企业', consigneeName: '收货企业', containerCount: 3 })
|
||||
})
|
||||
|
||||
it('uses version zero for create and extracts the id from the returned Detail', async () => {
|
||||
|
||||
Reference in New Issue
Block a user