test(acceptance): reuse fixed customers and align native fulfillment flows

This commit is contained in:
2026-10-23 04:48:02 +08:00
parent b92f7fe991
commit 139f6b1932
51 changed files with 1076 additions and 228 deletions
@@ -41,6 +41,12 @@ function model(fault = '', countPatch = {}) {
async requestMultipart(method, raw, file, token = this.token) {
calls.push({ method, raw, token, multipart: true }); assert.ok(file.content.length > 0)
if (raw.includes('/license?')) return response({ id: 'DRIVER', recordVersion: '1', licenseFileId: 'LICENSE' })
const evidenceKind = raw.match(/^\/api\/platform\/v1\/last-leg\/dispatches\/DS-ONE\/evidence\/(VEHICLE|DRIVER_PHOTO|DRIVER)$/)?.[1]
if (evidenceKind) {
assert.equal(token, 'admin-secret')
assert.equal(file.type, 'image/png')
return response({ fileId: { VEHICLE: '901', DRIVER_PHOTO: '902', DRIVER: '903' }[evidenceKind] })
}
assert.match(raw, /\/warehouse-transfers\/IN[01]\/measurement-photos\/files$/); assert.equal(token, options.pdaToken)
return response({ fileId: 'PHOTO', sizeBytes: file.content.length })
},
@@ -168,6 +174,9 @@ function model(fault = '', countPatch = {}) {
if (path.startsWith('/api/platform/v1/last-leg/dispatches/DS-ONE')) {
if (method === 'PUT') {
assert.equal(body.recordVersion, native.recordVersion)
assert.deepEqual(body.vehicle.evidenceFileIds, ['901'])
assert.deepEqual(body.driver.evidence.photoFileIds, ['902'])
assert.deepEqual(body.driver.evidence.fileIds, ['903'])
Object.assign(trip.trip, { vehicleId: body.vehicle.vehicleId, driverId: body.driver.driverId })
native.vehicleInfo = { vehicle: { mode: 'MASTER', vehicleId: 'VEHICLE', plate: trip.trip.vehiclePlate }, driver: { driverId: 'DRIVER' } }
native.recordVersion++