feat(fleet): integrate trip management and fee coverage workflows

This commit is contained in:
2026-10-03 04:35:55 +08:00
parent bca08f8749
commit dc35288a1b
87 changed files with 3774 additions and 233 deletions
@@ -0,0 +1,16 @@
import { describe, expect, it } from 'vitest'
import { physicalWeightKg, physicalWeightLb, totalPhysicalWeightLb } from './dispatchPhysicalWeight'
describe('dispatch physical weight', () => {
it('keeps absent or invalid physical weight unknown', () => {
for (const value of [null, undefined, '', 0, -1, Number.NaN, Number.POSITIVE_INFINITY]) expect(physicalWeightKg(value)).toBeNull()
expect(physicalWeightLb(10)).toBeCloseTo(22.046226218)
})
it('never substitutes billing volume weight and does not publish partial totals', () => {
const unknown = { grossWeightKg: null, volumeWeightKg: 999 }
expect(totalPhysicalWeightLb([{ grossWeightKg: 20 }, unknown])).toBeNull()
expect(totalPhysicalWeightLb([undefined])).toBeNull()
expect(totalPhysicalWeightLb([{ grossWeightKg: 20 }, { grossWeightKg: 30 }])).toBeCloseTo(110.23113109)
expect(totalPhysicalWeightLb([])).toBe(0)
})
})