deadhead-space-freight-tycoon/packages/content/test/bundle.test.ts

28 lines
1.1 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { content } from "../src/index";
describe("content bundle", () => {
it("contains every kind of content", () => {
expect(content.locations).toHaveLength(8);
expect(content.shipModels).toHaveLength(6);
expect(content.purchasableShipModels).toHaveLength(5);
expect(content.cargoTypes).toHaveLength(4);
expect(content.skills).toHaveLength(4);
expect(content.config.timeCompression).toBe(60);
});
it("looks up one item of each kind by id", () => {
expect(content.location("mars")?.name).toBe("Mars");
expect(content.shipModel("freighter")?.name).toBe("Freighter");
expect(content.cargoType("dangerous")?.name).toBe("Dangerous");
expect(content.skill("long-haul")?.name).toBe("Long Haul");
});
it("returns undefined for an unknown id without throwing", () => {
expect(content.location("pluto")).toBeUndefined();
expect(content.shipModel("x-wing")).toBeUndefined();
expect(content.cargoType("cheese")).toBeUndefined();
expect(content.skill("juggling")).toBeUndefined();
});
});