chore: more test cases

This commit is contained in:
Nathnael
2026-08-03 12:57:32 +00:00
parent 72532f36cd
commit 3b45990023
4 changed files with 627 additions and 0 deletions

View File

@@ -75,6 +75,7 @@ gateway-mock-it`) — the code is a read-only mount, not baked into an image.
| `src/g1-s4-split-closes-gap.it.ts` | container split closes the last 3-wagon gap, 14-box remainder |
| `src/g1-s5-cascading-expiry.it.ts` | one settle promotes twice; expiries terminal, invoices closed |
| `src/g1-s6-s8-offers-government-tiers.it.ts` | ignored offer, government preemption, USD/customs/plain tiers |
| `src/g2-weight.it.ts` | weight before slots: base pull, overage tolerance, split sized on base only, light cargo |
| `src/flows.ts` | freight business steps, ported from `e2e/freight/cypress/e2e/flows/import-utils.ts` |
## Findings pinned by these tests
@@ -101,6 +102,20 @@ what it actually does and says so in a comment, so a fix fails loudly:
priority config.
- **Freight sends a dev-shortcut amount** (1 minor unit, 10 for CAC) for every
non-`CBE_BILL` provider, with no short-payment guard.
- **A BUILT train's batch is blind to the pull limit** (`g2-weight`, last
describe). `remainingBudget` replaces the locomotive limits with
`{wagons: physicalWagons, weightTons: Infinity, lengthMeters: Infinity}` the
moment a schedule has a built train, so the batch reserves — and invoices —
a load the locomotives cannot pull. The only check left is at wagon
allocation, which then fails every tick with "Train set locomotives cannot
pull the gross weight … limit 3500T incl. tolerance". The customer is PAID
with zero wagons. Group 2 therefore runs its real weight scenarios on
locomotive PAIRS, where the limits survive.
- **The allocator weighs the whole consist, the batch weighs the booking.**
Allocation charges the tare of every wagon in the train set (53 × 22.4 T on
the G2 consist), while `needFor` charges only the tare of the wagons the
booking occupies — so the same 45-wagon load reads 3 528 T at reservation and
3 707.2 T at allocation. Two capacity models, one train.
- **Government preemption cannot reach a FULL train** (`g1-s6-s8`). `isFillable`
rejects a schedule whose `booking_window_status` is FULL before any budget or
victim is considered, and `refreshWindowStatus` re-derives that flag from live
@@ -143,6 +158,12 @@ what it actually does and says so in a comment, so a fix fails loudly:
- **One tenant per booking.** `seedTenantContracts` mints a company per booking
because a company may hold only one unpaid reservation at a time; staff book
and pay on their behalf, which is also the real Path B flow.
- **The weight axis is GROSS, but the column is not.**
`wagon_booking_allocations.allocated_weight_tons` holds CARGO only;
`allocatedGrossTons` adds each wagon type's tare, because the pull limit is
spent on both. Two 20ft at 28 T ride one wagon at 78.4 T gross — 35 of those
spend a 3 500 T locomotive pair, and reading the raw column would report
1 960 T and hide it.
- **Group 1 rides a BUILT train, not a loco pair.** `maxWagonsPerTrain` is not a
cap: `syncScheduleMaxWagons` recomputes it from locomotive length (54 here)
every fill pass. A built train's coupled consist wins outright, so