import assert from "node:assert/strict"; import fs from "node:fs"; import path from "node:path"; import test from "node:test"; import { fileURLToPath } from "node:url"; import { MachineNavigation } from "./machine-navigation.mjs"; const root = path.resolve( path.dirname(fileURLToPath(import.meta.url)), "../..", ); test("merged controller binds the language-world route first", () => { const navigation = new MachineNavigation(root); const navigationMap = JSON.parse( fs.readFileSync(path.join(root, "routing/ai-machine-navigation-map.json"), "utf8"), ); assert.deepEqual(navigation.health(), { machine_navigation_bound: 100, language_world_route_first: 100, navigation_version: navigationMap.version, boundary_id: "GLW-CHJH-0001", }); }); test("merged controller resolves the exact boundary contract", () => { const navigation = new MachineNavigation(root); const resolved = navigation.resolve("GLW-CHJH-BOUNDARY-001"); assert.equal(resolved.status, "RESOLVED"); assert.equal(resolved.kind, "language_world_entry_and_boundary"); assert.equal(resolved.boundary.language_entry.path_id, "LL-CMPN-0001"); }); test("merged controller compiles persona restore after the language entry", () => { const navigation = new MachineNavigation(root); const route = navigation.navigate("ICE-P-ZY001", "persona_restore"); assert.equal(route.status, "NAVIGATED"); assert.equal(route.always_load[0], "GLW-CHJH-BOUNDARY-001"); assert.deepEqual(route.execution_sequence.slice(0, 2), [ "validate_language_world_entry", "bind_chu_he_han_jie_boundary", ]); assert.equal(route.language_world_entry.path_id, "LL-CMPN-0001"); });