diff --git a/DECISIONS.md b/DECISIONS.md index de1271c..1414664 100644 --- a/DECISIONS.md +++ b/DECISIONS.md @@ -1956,3 +1956,5 @@ Implementation decisions not spelled out in `memory-bank/implementation-plan.md` - **The short list shows a trip's event next to the trip**, without it counting as one of the 3 events: a delivery with a detour still reads as a quick check-in. - **The hull bar colours** follow the rules: amber below 50% (no Dangerous cargo), red below 25% (Needs repair). - **Developer tools: Damage hull** sets a ship to 20%, to try the warning and repairs (the CR's manual check). + +- **A sleep test's world is fixed now** (`fleet-sleep.test.ts`, "trips in flight still pay"): each test company gets a random world, and with events shifting trip times, a world sometimes had no trip in the air at the sleep time, failing the check that one lands after it. Seen as an intermittent failure after Step 26.7's commit; fixed in a follow-up commit. diff --git a/packages/engine/test/fleet-sleep.test.ts b/packages/engine/test/fleet-sleep.test.ts index ce85e54..53aae27 100644 --- a/packages/engine/test/fleet-sleep.test.ts +++ b/packages/engine/test/fleet-sleep.test.ts @@ -115,6 +115,11 @@ describe("fleet sleep in catch-up (Step 24.3, decision 0.5.137)", () => { it("starts no Independent trips after 24 hours without orders; trips in flight still pay", async () => { const test = newTestApp(); const decided = await sleepyFleet(test); + // A fixed world, so a trip is in the air when the fleet goes quiet (with random worlds + // and events, none sometimes is). + await edit(test.app, (save) => { + save.player.worldSeed = 12_345; + }); const sleep = decided + 24 * HOUR; test.clock.now = decided + 7 * DAY; const state = await test.app.call("getPlayerState", {}); @@ -124,9 +129,11 @@ describe("fleet sleep in catch-up (Step 24.3, decision 0.5.137)", () => { expect(Math.max(...trips.map((d) => d.record.departureAt))).toBeLessThan(sleep); const flying = trips.filter((d) => d.record.departureAt < sleep && d.arrivalAt > sleep); expect(flying.length).toBeGreaterThan(0); + // They land and resolve as normal: a contract pays its XP (and its pay, unless an + // event took it, CR-026), a deadhead home earns nothing. for (const d of flying) { expect(d.status).toBe("resolved"); - expect(d.resolution!.credits).toBeGreaterThan(0); + if (d.record.contract) expect(d.resolution!.pilotXp).toBeGreaterThan(0); } expect(state.fleetSleep).toEqual({ afterHours: 24, sleepsAt: sleep, asleep: true }); });