优化
This commit is contained in:
@@ -285,10 +285,13 @@ async function fixtureDiscoveryModule() {
|
||||
assertStringId(weight.fileId, 'weight image file id')
|
||||
assertEqual(weight.recognitionStatus, 'CONFIRMED', 'weight recognition status')
|
||||
assertPresent(weight.confirmedAt, 'weight confirmation time')
|
||||
assertTrue(Number(weight.finalWeightKg) > 0, 'final weight must be positive')
|
||||
assertTrue(Number(weight.grossWeightKg) > 0, 'gross weight must be positive')
|
||||
assertTrue(Number(weight.netWeightKg) > 0, 'net weight must be positive')
|
||||
}
|
||||
assertApproxEqual(sum(platformMeasurement.weightResults, 'finalWeightKg'),
|
||||
assertApproxEqual(sum(platformMeasurement.weightResults, 'grossWeightKg'),
|
||||
platformMeasurement.actualGrossWeightKg, 0.001, 'measurement gross weight aggregate')
|
||||
assertApproxEqual(sum(platformMeasurement.weightResults, 'netWeightKg'),
|
||||
platformMeasurement.actualNetWeightKg, 0.001, 'measurement net weight aggregate')
|
||||
}, {
|
||||
actualGrossWeightKg: platformMeasurement.actualGrossWeightKg,
|
||||
weightResultCount: platformMeasurement.weightResults.length,
|
||||
@@ -468,6 +471,8 @@ async function terminalBillingModule() {
|
||||
'measurement package count')
|
||||
assertApproxEqual(summary.actualGrossWeightKg, platformMeasurement.actualGrossWeightKg, 0.001,
|
||||
'measurement gross weight')
|
||||
assertApproxEqual(summary.actualNetWeightKg, platformMeasurement.actualNetWeightKg, 0.001,
|
||||
'measurement net weight')
|
||||
assertApproxEqual(summary.actualVolumeCbm, platformMeasurement.actualVolumeCbm, 0.000001,
|
||||
'measurement volume')
|
||||
assertApproxEqual(summary.volumeWeightKg, platformMeasurement.volumeWeightKg, 0.001,
|
||||
@@ -488,8 +493,8 @@ async function terminalBillingModule() {
|
||||
assertStringId(item.id, 'published measurement item id')
|
||||
const expected = platformById.get(String(item.id))
|
||||
assertPresent(expected, `platform measurement item ${item.id}`)
|
||||
for (const field of ['packageCount', 'lengthCm', 'widthCm', 'heightCm', 'unitWeightKg',
|
||||
'totalWeightKg', 'unitVolumeCbm', 'totalVolumeCbm', 'volumeWeightKg']) {
|
||||
for (const field of ['packageCount', 'lengthCm', 'widthCm', 'heightCm',
|
||||
'unitVolumeCbm', 'totalVolumeCbm', 'volumeWeightKg']) {
|
||||
assertApproxEqual(item[field], expected[field], 0.000001, `${item.itemNo} ${field}`)
|
||||
}
|
||||
}
|
||||
@@ -521,10 +526,13 @@ async function terminalBillingModule() {
|
||||
assertPresent(expected, `platform weight result ${weight.id}`)
|
||||
assertEqual(String(weight.fileId), String(expected.fileId), 'weight image file id')
|
||||
assertEqual(weight.recognitionStatus, 'CONFIRMED', 'published weight status')
|
||||
assertApproxEqual(weight.finalWeightKg, expected.finalWeightKg, 0.001, 'published final weight')
|
||||
assertApproxEqual(weight.grossWeightKg, expected.grossWeightKg, 0.001, 'published gross weight')
|
||||
assertApproxEqual(weight.netWeightKg, expected.netWeightKg, 0.001, 'published net weight')
|
||||
}
|
||||
assertApproxEqual(sum(publishedWeights, 'finalWeightKg'),
|
||||
assertApproxEqual(sum(publishedWeights, 'grossWeightKg'),
|
||||
merchantBilling.measurementSummary.actualGrossWeightKg, 0.001, 'published weight aggregate')
|
||||
assertApproxEqual(sum(publishedWeights, 'netWeightKg'),
|
||||
merchantBilling.measurementSummary.actualNetWeightKg, 0.001, 'published net weight aggregate')
|
||||
}, { weightResultCount: arrayData(merchantBilling.weightResults).length })
|
||||
|
||||
await softLocalStep('phase2-client-billing',
|
||||
@@ -532,7 +540,7 @@ async function terminalBillingModule() {
|
||||
const summary = merchantBilling.measurementSummary
|
||||
const basis = merchantBilling.billingBasis
|
||||
const fee = merchantBilling.latestFee
|
||||
assertNumberEqual(basis.actualWeightKg, summary.actualGrossWeightKg, 'billing actual weight')
|
||||
assertNumberEqual(basis.actualWeightKg, summary.actualNetWeightKg, 'billing actual weight')
|
||||
assertNumberEqual(basis.actualVolumeCbm, summary.actualVolumeCbm, 'billing actual volume')
|
||||
assertNumberEqual(basis.actualWeightKg, fee.actualWeightKg, 'fee actual weight')
|
||||
assertNumberEqual(basis.actualVolumeCbm, fee.actualVolumeCbm, 'fee actual volume')
|
||||
|
||||
Reference in New Issue
Block a user