fix(bookings): display saved port codes when names are empty
This commit is contained in:
@@ -15,6 +15,21 @@ const detailResponse = (version = 0, status = 'DRAFT') => ({
|
||||
})
|
||||
|
||||
describe('ocean bookings api', () => {
|
||||
it.each([
|
||||
['宁波', '洛杉矶', 'CNNGB', 'USLAX', '宁波', '洛杉矶'],
|
||||
[null, null, 'CNNGB', 'USLAX', 'CNNGB', 'USLAX'],
|
||||
['', ' ', 'CNNGB', 'USLAX', 'CNNGB', 'USLAX'],
|
||||
['宁波', '洛杉矶', null, null, '宁波', '洛杉矶'],
|
||||
[null, '', null, ' ', null, null],
|
||||
])('列表港口名称 %s / %s 为空时展示已保存代码', async (departurePortName, destinationPortName, departurePortCode, destinationPortCode, pol, pod) => {
|
||||
vi.spyOn(http, 'get').mockResolvedValue({ code: '200', data: {
|
||||
records: [{ ...detailResponse().oceanBooking, departurePortName, destinationPortName, departurePortCode, destinationPortCode }],
|
||||
page: 1, size: 20, total: 1, pages: 1,
|
||||
} })
|
||||
const result = await listOceanBookings({ page: 1, size: 20 })
|
||||
expect(result.records[0]).toMatchObject({ pol, pod, departurePortName, destinationPortName, departurePortCode, destinationPortCode })
|
||||
})
|
||||
|
||||
it('预计到港使用窄命令并规范化详情回显与列表到港字段', async () => {
|
||||
const payload = { expectedVersion: 3, estimatedArrivalAt: '2026-10-25T10:00:00' }
|
||||
const raw = detailResponse(4, 'RELEASED')
|
||||
|
||||
Reference in New Issue
Block a user