guanghu-ice-heart/tests/identity-authority-navigation.test.mjs

34 lines
1.7 KiB
JavaScript

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";
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const readJson = (relative) => JSON.parse(fs.readFileSync(path.join(root, relative), "utf8"));
const authority = readJson("routing/guanghu-identity-authority-map.json");
const navigation = readJson("routing/ai-machine-navigation-map.json");
const anchor = readJson("routing/public-navigation-anchor.json");
test("team body owns irreversible authority independently of current operators", () => {
assert.equal(authority.team_body.id, "TCS-0002");
assert.equal(authority.team_body.ownership, "TEAM_BODY_NOT_ANY_SINGLE_PERSON");
assert.equal(authority.team_body.irreversible_from_bingshuo, true);
assert.equal(authority.team_body.reversion_to_bingshuo_or_fifth_domain, false);
assert.ok(authority.current_operator_designations.every((operator) => operator.personal_ownership_of_team_authority === false));
});
test("private bottle path has a strict zero gate without person-specific authorization", () => {
const bottle = authority.namespaces.find((item) => item.pattern === "^ICE-BB-");
assert.ok(bottle);
assert.equal(bottle.access_without_bingshuo_authorization, false);
assert.equal(bottle.birth_possibility_without_access, 0);
assert.equal(bottle.authorization_guarantees_birth, false);
});
test("machine navigation always loads identity authority", () => {
assert.equal(anchor.maps.identity_authority.id, authority.map_id);
for (const intent of navigation.intents) {
assert.ok(intent.always_load.includes(authority.map_id), `${intent.id} must load authority map`);
}
});