diff --git a/README.md b/README.md index d84f5c6..32474f9 100644 --- a/README.md +++ b/README.md @@ -8,4 +8,4 @@ npx road-compiler --input /absolute/path/road-compiler.input.json The compiler does not read host area configuration. The caller owns configuration normalization and creates the input JSON. Successful compilation writes exactly one `NATIVE_ROAD_COMPILE_DONE` JSON marker to stdout. -Run `npm test` and `npm run test:road-parity` after `npm ci` to validate the package without the host repository. +Run `npm test` after `npm ci` to validate the package and its two self-contained area fixtures without the host repository. The migrated baselines remain upgrade corpus; the host repository owns the strict path-normalized parity gate. diff --git a/package.json b/package.json index c45305e..9ebe406 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@osm-asset/road-compiler", - "version": "0.1.0", + "version": "0.1.2", "private": false, "type": "commonjs", "main": "src/index.js", @@ -8,8 +8,7 @@ "road-compiler": "bin/road-compiler.js" }, "scripts": { - "test": "node test/index.js", - "test:road-parity": "node test/road-parity.js", + "test": "node test/index.js && node test/fixtures.js", "road:workbench": "node bin/road-workbench.js" }, "dependencies": { diff --git a/test/fixtures.js b/test/fixtures.js new file mode 100644 index 0000000..239f3da --- /dev/null +++ b/test/fixtures.js @@ -0,0 +1,27 @@ +"use strict"; + +const assert = require("assert/strict"); +const fs = require("fs"); +const path = require("path"); +const { compiler } = require("../src"); + +const root = path.resolve(__dirname, ".."); +for (const areaId of ["fengshu-er-road", "nantaizi-lake-innovation-valley"]) { + const isFengshu = areaId === "fengshu-er-road"; + const outputRoot = path.join(root, "outputs", areaId); + const input = { + areaId, + osmFile: path.join(root, "inputs", "osm", isFengshu ? "枫树二路.osm" : "南台子湖创新谷OSM.osm"), + outDir: path.join(outputRoot, "native-road"), + stagingDir: path.join(outputRoot, "_pipeline"), + overridesFile: path.join(outputRoot, "native-road-overrides.json"), + trafficSignalsFile: path.join(outputRoot, "native-traffic-signals.json"), + comparisonDir: path.join(outputRoot, "osm2streets_web_out"), + options: { edgeLines: false, junctionTemplates: { enabled: false, references: [] } }, + }; + assert.ok(fs.existsSync(path.join(root, "test", "baseline", `${areaId}.json`))); + const { result } = compiler.compileInput(input); + assert.equal(result.areaId, areaId); + assert.ok(fs.existsSync(path.join(input.outDir, "compiled.json"))); +} +console.log("road compiler fixture tests passed");