From b76acbacac0aa1086f7c1d2fc3059581395c2f50 Mon Sep 17 00:00:00 2001 From: Kamil Krzywda Date: Mon, 21 Sep 2026 23:13:21 +0000 Subject: [PATCH] fix(e2e): bound post-departure fuel burn in refuel-cost spec (#88) --- e2e/queue.spec.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/e2e/queue.spec.ts b/e2e/queue.spec.ts index 73f3f0a..7d09d2b 100644 --- a/e2e/queue.spec.ts +++ b/e2e/queue.spec.ts @@ -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 () => {