import { content, upgradeMaxLevel, upgradePercentPerLevel, upgrades } from "@deadhead/content"; import { describe, expect, it } from "vitest"; import { checkRoute, effectiveStats } from "../src/index"; /** Every upgrade at its highest level for the model (decision 0.5.63). */ const maxedStats = (modelId: string) => effectiveStats( content.shipModel(modelId)!, Object.fromEntries(upgrades.map((u) => [u.id, upgradeMaxLevel(u, modelId)])), content, ); const earth = content.location("earth")!; const moon = content.location("moon")!; const mars = content.location("mars")!; const jupiter = content.location("jupiter-cloud-platform")!; describe("upgrade caps for the CR-012 lineup (decision 0.5.67)", () => { it("a maxed Lighter never reaches Mars from Earth or the Moon", () => { const lighter = maxedStats("lighter"); for (const from of [earth, moon]) { expect(checkRoute(lighter, from, mars, content.config).ok).toBe(false); } }); it("a maxed Clipper carries less than a base Freighter", () => { expect(maxedStats("clipper").cargoCapacityTonnes).toBeLessThan( content.shipModel("freighter")!.cargoCapacityTonnes, ); }); it("a maxed Courier is slower than a base Clipper", () => { expect(maxedStats("courier").cruiseSpeedKmPerGameHour).toBeLessThan( content.shipModel("clipper")!.cruiseSpeedKmPerGameHour, ); }); it("only Bulk Haulers reach Jupiter from Earth, even maxed", () => { for (const ship of content.shipModels) { const reaches = checkRoute(maxedStats(ship.id), earth, jupiter, content.config).ok; expect(reaches, ship.id).toBe(ship.id === "bulk-hauler"); } }); it("gives the Courier 380 % tank per tanks level (CR-015)", () => { expect(upgradePercentPerLevel(content.upgrade("fuel-tanks")!, "courier")).toBe(380); }); });