47 lines
1.6 KiB
TypeScript
47 lines
1.6 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
||
import {
|
||
cargoTypes,
|
||
gameConfig,
|
||
gameConfigSchema,
|
||
locations,
|
||
shipModels,
|
||
skills,
|
||
} from "../src/index";
|
||
|
||
// Placeholder average tutorial payout until Phase 12 uses real sim numbers:
|
||
// Standard cargo over ~0.384M km (Earth–Moon), at the average mass a Courier
|
||
// can carry from the configured range, times the tutorial share.
|
||
const EARTH_MOON_MILLION_KM = 0.384;
|
||
|
||
describe("game config", () => {
|
||
it("passes the schema", () => {
|
||
expect(() => gameConfigSchema.parse(gameConfig)).not.toThrow();
|
||
});
|
||
|
||
it("uses 1 real minute = 1 game hour", () => {
|
||
expect(gameConfig.timeCompression).toBe(60);
|
||
});
|
||
|
||
it("has one Long Haul cut-off per Long Haul level", () => {
|
||
const longHaul = skills.find((s) => s.id === "long-haul")!;
|
||
expect(gameConfig.longHaulCutoffsMillionKm).toHaveLength(longHaul.maxLevel);
|
||
});
|
||
|
||
it("makes a Courier plus an Earth bay affordable after 15–25 tutorial runs", () => {
|
||
const courier = shipModels.find((s) => s.id === "courier")!;
|
||
const earth = locations.find((l) => l.id === "earth")!;
|
||
const standard = cargoTypes.find((c) => c.id === "standard")!;
|
||
|
||
const averageMass = (gameConfig.contractMassTonnes.min + courier.cargoCapacityTonnes) / 2;
|
||
const averageTutorialPayout =
|
||
standard.basePayPerTonnePerMillionKm *
|
||
averageMass *
|
||
EARTH_MOON_MILLION_KM *
|
||
gameConfig.tutorialPayoutShare;
|
||
|
||
const runs = (courier.price + earth.bayLeasePrice) / averageTutorialPayout;
|
||
expect(runs).toBeGreaterThanOrEqual(15);
|
||
expect(runs).toBeLessThanOrEqual(25);
|
||
});
|
||
});
|