修正四期全量验收夹具
This commit is contained in:
@@ -210,6 +210,8 @@ test('module is context injected, blocks missing prerequisites and excludes forb
|
||||
assert.doesNotMatch(source, /https?:\/\/|process\.env|fetch\(/)
|
||||
assert.doesNotMatch(source, /addCoverageGap|coverageGap\(/)
|
||||
assert.match(source, /deploymentBlocker: true/)
|
||||
assert.match(source, /contactPhone: '\d+'/)
|
||||
assert.doesNotMatch(source, /contactPhone: '\+[^']+'/)
|
||||
for (const forbidden of ['/outbounds', '/receive-pallets', '/outbound', '/delivery', '/dispatch', '/export']) {
|
||||
assert.equal(source.includes(forbidden), false, forbidden)
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ function partnerWarehousePayload(context) {
|
||||
return {
|
||||
tenantId: 0, warehouseCode: `P4B-${suffix}`.slice(0, 50), warehouseName: `${context.marker} 采购合作仓`,
|
||||
warehouseType: 'OVERSEAS_PARTNER', countryCode: 'US', timezone: 'UTC-8', contactName: 'Phase4 QA',
|
||||
contactPhone: '+1-213-555-0177', contactEmail: null, status: 'ACTIVE', remark: `${context.marker}-procurement-fixture`,
|
||||
contactPhone: '12135550177', contactEmail: null, status: 'ACTIVE', remark: `${context.marker}-procurement-fixture`,
|
||||
address: { addressType: 'WAREHOUSE', countryCode: 'US', stateProvince: 'California', city: 'Los Angeles',
|
||||
district: 'Commerce', postalCode: '90040', addressLine1: '601 Procurement Partner Avenue', addressLine2: null,
|
||||
latitude: null, longitude: null },
|
||||
|
||||
@@ -6,6 +6,16 @@ const TRUCK = '/api/platform/v1/truck-appointments'
|
||||
function id(value) { return value == null ? '' : String(value) }
|
||||
function codeOf(response) { return response?.body?.code == null ? 'missing' : String(response.body.code) }
|
||||
|
||||
async function requestWithTransientRetry(context, method, path, body) {
|
||||
let response = null
|
||||
for (let attempt = 1; attempt <= 3; attempt += 1) {
|
||||
response = await context.request(method, path, body)
|
||||
if (response?.http !== 0) return response
|
||||
if (attempt < 3) await new Promise((resolve) => setTimeout(resolve, 500 * attempt))
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
async function actionRequest(context, path, endpoint, version) {
|
||||
try {
|
||||
const response = await fetch(`${context.options.gateway}${path}/${endpoint}`, {
|
||||
@@ -64,7 +74,7 @@ export async function run(context) {
|
||||
context.assert(MODULE, '已放舱订舱可直接创建订舱级拖车预约', oceanResponse,
|
||||
id(booking?.id) === id(ocean.id) && booking?.status === 'RELEASED',
|
||||
`oceanBookingId=${id(booking?.id) || 'missing'}, status=${booking?.status || 'missing'}`, OPTIONS)
|
||||
const carrierResponse = await context.request('GET',
|
||||
const carrierResponse = await requestWithTransientRetry(context, 'GET',
|
||||
'/api/platform/v1/suppliers?tenantId=0&category=TRUCKING&status=ACTIVE&page=1&size=20')
|
||||
const carrierPage = context.apiSuccess(MODULE, '读取 ACTIVE TRUCKING 承运商事实源', carrierResponse, '', OPTIONS)
|
||||
const carrier = carrierPage?.records?.find?.((item) => item?.id && item?.name)
|
||||
|
||||
Reference in New Issue
Block a user