mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 20:10:56 +00:00
Empties had no way onto a departure: the return record could name a train but nothing seated it on a wagon. Export schedules now expose a loading action that packs selected returns onto free wagons at one 40ft or two 20ft each, enforced both in the picker and in the API (existing empties on the schedule count against their wagon). Adds container_size, train_schedule_id and wagon_sequence_no to freight.empty_container_returns.
24 lines
628 B
TypeScript
24 lines
628 B
TypeScript
import { assertWagonLoad } from './empty-container-wagon.util';
|
|
|
|
describe('assertWagonLoad', () => {
|
|
it('accepts one 40ft or two 20ft per wagon', () => {
|
|
expect(() =>
|
|
assertWagonLoad(
|
|
new Map([
|
|
[1, ['40']],
|
|
[2, ['20', '20']],
|
|
[3, ['20']],
|
|
]),
|
|
),
|
|
).not.toThrow();
|
|
});
|
|
|
|
it('rejects a 40ft sharing a wagon', () => {
|
|
expect(() => assertWagonLoad(new Map([[4, ['40', '20']]]))).toThrow(/Wagon 4/);
|
|
});
|
|
|
|
it('rejects three containers on a wagon', () => {
|
|
expect(() => assertWagonLoad(new Map([[5, ['20', '20', '20']]]))).toThrow(/Wagon 5/);
|
|
});
|
|
});
|