test(phase3): complete remaining hard-gate fixtures
This commit is contained in:
@@ -69,13 +69,13 @@ async function buildOcean(context, template, status, index) {
|
||||
throw new Error(`unsupported ocean status ${status}`)
|
||||
}
|
||||
|
||||
function truckPayload(context, oceanBooking, index) {
|
||||
function truckPayload(context, oceanBooking, carrier, index) {
|
||||
const value = suffix(context, index)
|
||||
return { outboundOrderId: null, oceanBookingId: oceanBooking.id,
|
||||
containerBookingId: null, loadingPlanId: null,
|
||||
warehouseId: oceanBooking.warehouseId, customerId: oceanBooking.customerId,
|
||||
customerName: oceanBooking.customerName,
|
||||
carrierId: null, carrierName: null, fleetContact: '人工验收联系人', fleetPhone: '13800000004',
|
||||
customerName: null,
|
||||
carrierId: id(carrier.id), carrierName: carrier.name, fleetContact: '人工验收联系人', fleetPhone: '13800000004',
|
||||
driverName: `人工司机-${value}`, driverPhone: '13800000005', vehicleNo: `粤B${value.slice(-6)}`,
|
||||
storeName: '人工验收仓', storeContact: '仓库联系人', storePhone: '13800000006',
|
||||
storeAddress: '深圳市南山区人工验收地址', storeCity: '深圳市', storeZipcode: '518000',
|
||||
@@ -85,7 +85,12 @@ function truckPayload(context, oceanBooking, index) {
|
||||
}
|
||||
|
||||
async function createTruck(context, oceanBooking, index) {
|
||||
const response = await context.request('POST', TRUCK_BASE, truckPayload(context, oceanBooking, index))
|
||||
const carrierResponse = await context.request('GET',
|
||||
'/api/platform/v1/suppliers?tenantId=0&category=TRUCKING&status=ACTIVE&page=1&size=20')
|
||||
const carrierPage = context.apiSuccess(MODULE, `读取拖车状态样本 ${index} 的 ACTIVE 承运商`, carrierResponse, '', OPTIONS)
|
||||
const carrier = carrierPage?.records?.find?.((item) => item?.id && item?.name)
|
||||
if (!carrier) throw new Error(`创建拖车样本 ${index} 缺少 ACTIVE 承运商`)
|
||||
const response = await context.request('POST', TRUCK_BASE, truckPayload(context, oceanBooking, carrier, index))
|
||||
const value = context.apiSuccess(MODULE, `创建拖车状态样本 ${index}`, response, '', OPTIONS)
|
||||
if (!value?.id) throw new Error(`创建拖车样本 ${index} 失败`)
|
||||
return value
|
||||
|
||||
Reference in New Issue
Block a user