deadhead-space-freight-tycoon/packages/engine/test/ported/board-keys.test.ts

19 lines
853 B
TypeScript

// Ported from apps/server/test (CR-014 Step 14.5): the database's one-board-per-key
// constraint is now the engine storing one board per location and period.
import { describe, expect, it } from "vitest";
import { useTestApp, call, readSave, signUpOwner } from "../support";
const testApp = useTestApp();
describe("contract boards keyed by location (CR-002)", () => {
it("keeps one stored board per location and period", async () => {
const { app } = testApp();
const owner = await signUpOwner(app);
await call(app, owner, "GET", "/api/locations/earth/board");
await call(app, owner, "GET", "/api/locations/moon/board");
await call(app, owner, "GET", "/api/locations/moon/board");
const boards = (await readSave(app)).contractBoards;
expect(boards.map((b) => b.locationId).sort()).toEqual(["earth", "moon"]);
});
});