"use strict"; const assert = require("assert/strict"); const fs = require("fs"); const path = require("path"); const compiler = require("../src"); assert.equal(typeof compiler.laneGeometry.laneCenterline, "function"); assert.equal(typeof compiler.gaodeReference.convertGeoJson, "function"); assert.equal(typeof compiler.turnLaneArrows.buildCustomTurnLaneArrows, "function"); assert.equal(typeof compiler.complexJunction.buildComplexJunctionGeometry, "function"); assert.equal(typeof compiler.nativeRoad.compileRoadModel, "function"); assert.equal(typeof compiler.check.checkOutput, "function"); assert.equal(typeof compiler.layerManifest.manifestForArea, "function"); const manifest = compiler.layerManifest.manifestForArea("fixture"); assert.equal(manifest.contract, "native-road-package/v1.1"); assert.equal(manifest.layers.length, 12); assert.deepEqual(manifest.layers.filter((layer) => layer.role === "semantic").map((layer) => layer.source), ["lane_centerlines", "connectors"]); assert.equal(manifest.layers.find((layer) => layer.source === "center_lines").splitBy.cases[0].match, "white"); const fixture = path.join(__dirname, "fixtures", "fengshu-er-road.osm"); assert.ok(fs.existsSync(fixture)); assert.throws(() => compiler.compiler.validateInput({ id: "area" }), /RoadCompilerInput/); const model = compiler.nativeRoad.compileRoadModel(fs.readFileSync(fixture, "utf8"), { schema: "native-road-overrides/v1", overrides: [] }); assert.equal(model.roads.length, 24); console.log("road compiler package tests passed");