import { content, upgradePercentPerLevel, type ShipModel } from "@deadhead/content"; import { describe, expect, it } from "vitest"; import { checkRoute } from "../src/index"; const courier = content.shipModel("courier")!; const tanks = content.upgrade("fuel-tanks")!; const earth = content.location("earth")!; const moon = content.location("moon")!; const mars = content.location("mars")!; /** A Courier with fuel tanks at `level` (decision 0.5.63: linear % of base range). */ const withTanks = (level: number): ShipModel => ({ ...courier, fuelRangeMillionKm: courier.fuelRangeMillionKm * (1 + (upgradePercentPerLevel(tanks, "courier") * level) / 100), }); // Decision 0.5.68 as amended by CR-015: a plain yes or no on the fixed map. describe("Courier to Mars (decision 0.5.68)", () => { it("reaches Mars from Earth with maxed fuel tanks", () => { expect(checkRoute(withTanks(3), earth, mars)).toEqual({ ok: true }); }); it("can't reach Mars from Earth or the Moon with fuel tanks at level 2 or less", () => { for (const level of [0, 1, 2]) { expect(checkRoute(withTanks(level), earth, mars).ok, `level ${level}`).toBe(false); expect(checkRoute(withTanks(level), moon, mars).ok, `level ${level}`).toBe(false); } }); });