import { content } from "@deadhead/content"; import { describe, expect, it } from "vitest"; import { locationPosition } from "../src/index"; const fromSun = (id: string) => { const { x, y } = locationPosition(content.location(id)!); return Math.hypot(x, y); }; describe("location positions", () => { it("puts Earth about 150 million km from the Sun", () => { expect(fromSun("earth")).toBeGreaterThan(147); expect(fromSun("earth")).toBeLessThan(153); }); it("puts Mars 206–250 million km from the Sun", () => { expect(fromSun("mars")).toBeGreaterThan(206); expect(fromSun("mars")).toBeLessThan(250); }); it("puts Jupiter Cloud Platform 740–820 million km from the Sun", () => { expect(fromSun("jupiter-cloud-platform")).toBeGreaterThan(740); expect(fromSun("jupiter-cloud-platform")).toBeLessThan(820); }); it("puts Ceres Station on its ~414 million km orbit", () => { expect(fromSun("ceres-station")).toBeCloseTo(414, 0); }); it("keeps the Moon within 1 million km of Earth", () => { const earth = locationPosition(content.location("earth")!); const moon = locationPosition(content.location("moon")!); expect(Math.hypot(moon.x - earth.x, moon.y - earth.y)).toBeLessThan(1); }); it("never moves (decision 0.5.93)", () => { for (const location of content.locations) { expect(locationPosition(location)).toEqual(locationPosition(location)); } }); });