/** 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 plus doors into both detailed city boards", () => {
    assert.deepEqual(
      CALIFORNIA_CITY.chapters.map((chapter) => chapter.id),
      ["california-overview", "la-sf-us-101", "la-sf-i-5", "los-angeles", "san-francisco"],
    );
  });

  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);
    assert.equal(CALIFORNIA_CITY.districts.length, 0);
  });
});
