/** Contract checks for the state-scale rendering adapter. */ import assert from "node:assert/strict"; import { describe, it } from "node:test"; import CALIFORNIA_CITY, { CALIFORNIA_I_5, CALIFORNIA_US_101 } from "../cities/california.ts"; describe("California corridor city", () => { it("keeps the two transport routes on one coarse render board", () => { assert.equal(CALIFORNIA_CITY.id, "california"); assert.equal(CALIFORNIA_CITY.roads.length, 2); assert.ok(CALIFORNIA_US_101.length > 10); assert.ok(CALIFORNIA_I_5.length > 10); for (const path of [CALIFORNIA_US_101, CALIFORNIA_I_5]) { for (const [lat, lng] of path) { assert.ok(lat >= CALIFORNIA_CITY.bounds.minLat && lat <= CALIFORNIA_CITY.bounds.maxLat); assert.ok(lng >= CALIFORNIA_CITY.bounds.minLng && lng <= CALIFORNIA_CITY.bounds.maxLng); } } }); it("offers route chapters, doors into both detailed boards, and the north", () => { // Order is asserted rather than membership, and the first entry doubly so: // `createScene` opens on `chapters[0]` and `scripts/brand-assets/shots.mjs` // reaches the others by *index*, so an insertion anywhere but the end // re-points every marketing still at a different photograph. assert.deepEqual( CALIFORNIA_CITY.chapters.map((chapter) => chapter.id), [ "california-overview", "la-sf-us-101", "la-sf-i-5", "los-angeles", "san-francisco", "shasta-cascades", ], ); }); it("puts a pose on the half of the state the corridor never reaches", () => { // The board runs to 42.05 N. Before the north chapter existed every authored // pose sat below 38, so a visitor who never dragged the camera saw none of // the two hundred kilometres of state above San Francisco. const north = CALIFORNIA_CITY.chapters.filter((chapter) => chapter.focus.lat > 39); assert.ok(north.length >= 1, "no chapter looks at the north of the board"); for (const chapter of north) { assert.ok( chapter.focus.lat < CALIFORNIA_CITY.bounds.maxLat && chapter.focus.lng > CALIFORNIA_CITY.bounds.minLng, `chapter "${chapter.id}" points off the board`, ); } }); it("uses a state-scale field rather than city-scale cells", () => { assert.ok(CALIFORNIA_CITY.cellLat >= 0.01); assert.ok(CALIFORNIA_CITY.cellLng >= 0.01); // This used to assert zero districts, which was the pack's old promise that // the state board carried no cities at all — and that emptiness was the // defect, not the design. The board now declares its metros on purpose; a // coarse *field* is what makes it state-scale, not an absence of built // things. `packs/californiaBoard.test.ts` holds the districts to account. assert.ok(CALIFORNIA_CITY.districts.length >= 12); }); });