mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 08:48:11 +00:00
fix issue
This commit is contained in:
@@ -22,17 +22,21 @@ describe('BookingBatchService.smartBulkNeed', () => {
|
||||
s: WagonStockLedger,
|
||||
l: { fromEdge: number; toEdge: number },
|
||||
r: Map<string, number>,
|
||||
ids: readonly string[],
|
||||
) => { need: { wagons: number }; perType: Array<{ wagonTypeId: string; wagons: number }> } | null;
|
||||
}
|
||||
).smartBulkNeed(booking, wagonDims, stock, { fromEdge: 0, toEdge: 1 }, rank);
|
||||
).smartBulkNeed(booking, wagonDims, stock, { fromEdge: 0, toEdge: 1 }, rank, allowedIds);
|
||||
|
||||
const nw5 = { id: 'wt-nw5', capacityTons: 70 };
|
||||
const pw2 = { id: 'wt-pw2', capacityTons: 70 };
|
||||
// Shaped like a BATCH POOL entity: cargoType WITHOUT the wagonTypes
|
||||
// relation (the pool query never joins it) — allowed types must come from
|
||||
// the ids parameter, or every pool bulk booking reads as unseatable.
|
||||
const perishable = {
|
||||
id: 'cargo-perishable',
|
||||
wagonTypes: [nw5, pw2],
|
||||
tonsPerWagonMap: { [nw5.id]: 30, [pw2.id]: 20 },
|
||||
};
|
||||
const allowedIds = [nw5.id, pw2.id];
|
||||
const wagonDims = {
|
||||
container: { lengthMeters: 14, tareWeightTons: 24, capacityTons: 70 },
|
||||
bulk: { lengthMeters: 14, tareWeightTons: 24, capacityTons: 70 },
|
||||
@@ -113,9 +117,10 @@ describe('BookingBatchService.smartBulkNeed', () => {
|
||||
s: WagonStockLedger,
|
||||
l: { fromEdge: number; toEdge: number },
|
||||
r: Map<string, number>,
|
||||
ids: readonly string[],
|
||||
) => { need: { wagons: number }; perType: Array<{ wagonTypeId: string; wagons: number }> } | null;
|
||||
}
|
||||
).smartBulkNeed(booking(200), wagonDims, stock, { fromEdge: 0, toEdge: 2 }, contested);
|
||||
).smartBulkNeed(booking(200), wagonDims, stock, { fromEdge: 0, toEdge: 2 }, contested, allowedIds);
|
||||
expect(smart).not.toBeNull();
|
||||
expect(smart!.perType).toEqual([{ wagonTypeId: pw2.id, wagons: 10 }]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user