test(fleet): verify same-route costs from three real pallet sources

This commit is contained in:
2026-10-04 12:07:37 +08:00
parent dc993c9713
commit 791d1a650f
5 changed files with 177 additions and 3 deletions
+3 -2
View File
@@ -107,7 +107,8 @@ export async function runCrossCustomer(config, { env = process.env, outputRoot =
}
const fixture = await prepare(context, { execute: true, warehouseId: config.warehouseId, destinationWarehouseId: config.destinationWarehouseId, pdaToken: picker.token, readInventory })
save('fixture.json', fixture)
await verify(context, fixture, { execute: true, readInventory })
const verification = await verify(context, fixture, { execute: true, readInventory })
if (verification?.status !== 'VERIFIED' || verification.tripNo !== fixture.tripNo) throw Error('Current fixture verification incomplete')
const trip = context.createdResources.fleetTrips?.find(row => row.tripNo === fixture.tripNo)
if (!trip) throw Error('Original fixture trip missing for resource completion')
const beforeClosure = []
@@ -116,7 +117,7 @@ export async function runCrossCustomer(config, { env = process.env, outputRoot =
const afterClosure = []
for (const member of fixture.members) afterClosure.push(await readInventory({ marker: context.marker, customerId: member.customerId, warehouseId: config.warehouseId }))
if (JSON.stringify(beforeClosure) !== JSON.stringify(afterClosure)) throw Error('Trip closure changed customer inventory')
report = { success: context.createdResources.fleetCrossCustomer?.status === 'VERIFIED'
report = { success: verification.status === 'VERIFIED'
&& trip.closure?.status === 'CARGO_COMPLETED_AND_RESOURCES_RELEASED', closureInventoryUnchanged: true }
} catch (error) {
report = { success: false, error: error instanceof Error ? error.message : 'CROSS_CUSTOMER_FAILED' }