baseLiters

This commit is contained in:
Marshal
2026-08-12 13:29:31 +00:00
parent ddcdcab518
commit dd39c2be7c
2 changed files with 17 additions and 0 deletions

View File

@@ -118,6 +118,19 @@ describe('RateChangeRequestsService', () => {
expect(request.payload).toEqual({ destinationYardId: 'yard-c' });
});
it('carries baseLiters — a switch to PER_LITER keeps its billing base', async () => {
const { service } = build({
rate: liveRate({ rateUnit: 'PER_WAGON', baseLiters: null }),
});
const request = await service.submit({
rateId: 'rate-1',
update: { rateUnit: 'PER_LITER', baseLiters: 3 },
});
expect(request.payload).toEqual({ rateUnit: 'PER_LITER', baseLiters: 3 });
});
it('rejects a no-op — 100 posted against a live 100.0000 is not a change', async () => {
const { service } = build();
await expect(

View File

@@ -42,6 +42,10 @@ const DIFFABLE_FIELDS = [
// LIVE last-mile rate would diff to "nothing changed".
'minKm',
'maxKm',
// PER_LITER fuel surcharge billing base. Missing here, a switch to PER_LITER
// dropped the submitted liters and validation failed with "needs a base
// liters amount" even though the payload carried one.
'baseLiters',
] as const;
/**