v0.46.0 — queue: consume-on-dispatch, chain backstops, sell guard + tests (#88) #93

Merged
kamilkrzywda merged 2 commits from feat/queue-tests-fixes into master 2026-09-22 01:22:26 +02:00
Showing only changes of commit b76acbacac - Show all commits
+5 -2
View File
@@ -569,8 +569,11 @@ test('a drained tank is topped up before a chained leg at exactly the rep-discou
}, { timeout: 120_000, message: `waiting for the auto-chained leg ${DEST} → ${QUEUE}` }).toBe(true);
const s = await getState(page);
expect(s.planes.find((x) => x.id === 'plane-starter')!.fuel).toBeCloseTo(target, 6); // departed with exactly the post-top-up level…
expect(s.account.cash).toBeCloseTo(cashBeforeChain - expectedCost, 6); // …at exactly the rep-discounted cost
// Exact fuel equality is impossible — this snapshot lands after leg 2's departure burn; the exact top-up level × rep-discounted price is pinned by the cash assertion below.
const fuel = s.planes.find((x) => x.id === 'plane-starter')!.fuel;
expect(fuel).toBeLessThanOrEqual(target); // can only have burned since departure…
expect(fuel).toBeGreaterThan(1.4 * required2); // …and a wrong top-up level (≤ required2, or none at all) lands below this bound
expect(s.account.cash).toBeCloseTo(cashBeforeChain - expectedCost, 6); // at exactly the rep-discounted cost
// Let leg 2 finish so the next test starts from a known airport.
await expect.poll(async () => {