import { describe, expect, it } from "vitest"; import { locationSchema, locations } from "../src/index"; // The cargo types planned for Step 2.4; replaced by the real data once it exists. const cargoTypeIds = ["standard", "heavy", "high-value", "dangerous"]; describe("locations", () => { it("all pass the schema", () => { for (const location of locations) { expect(() => locationSchema.parse(location)).not.toThrow(); } }); it("has exactly five locations with unique ids", () => { expect(locations).toHaveLength(5); expect(new Set(locations.map((l) => l.id)).size).toBe(5); }); it("starts with exactly Earth and Moon discovered", () => { const discovered = locations.filter((l) => l.startsDiscovered).map((l) => l.id); expect(discovered.sort()).toEqual(["earth", "moon"]); }); it("references only existing cargo types", () => { for (const location of locations) { for (const cargoId of [...location.produces, ...location.demands]) { expect(cargoTypeIds).toContain(cargoId); } } }); it("gives Earth the highest launch multiplier", () => { const earth = locations.find((l) => l.id === "earth")!; for (const location of locations) { if (location !== earth) { expect(earth.launchCostMultiplier).toBeGreaterThan(location.launchCostMultiplier); } } }); });