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 read = (relative) => fs.readFileSync(path.join(root, relative), 'utf8') test('public routing starts from five domains and lets the number select the verifier', () => { const contract = JSON.parse(read('contracts/domain-number-routing.json')) assert.equal(contract.public_entry, 'FIVE_DOMAIN_HOME') assert.equal(contract.user_selects_domain_before_number, false) assert.equal(contract.route_key, 'USER_NUMBER') assert.equal(contract.routing.number_shape_is_authority, false) assert.equal(contract.routing.client_supplied_domain_is_authority, false) assert.equal(contract.routing.unknown_or_unavailable_route, 'FAIL_CLOSED_BEFORE_LOGIN') assert.equal(contract.registries.FIFTH_DOMAIN.ownership, 'ICE-GL_INFINITY_PRIVATE_DOMAIN') assert.equal(contract.registries.ENTERPRISE_FOUR_DOMAINS.ownership, 'TCS_0002_ENTERPRISE_REALITY_BODY') }) test('the public shell shows five domains and login is domain-routed', () => { const frontend = read('src/main.tsx') const login = read('src-tauri/src/code_repo_login.rs') const router = read('src-tauri/src/zero_point.rs') for (const name of ['光湖主域', '光湖分域', '光湖零域', '光湖零感域', '第五域 · 光湖本源域']) { assert.match(frontend, new RegExp(name.replace('·', '\\·'))) } assert.match(frontend, /输入编号进入所属域/) assert.match(frontend, /TCS-GL-/) assert.match(frontend, /肥猫 · TCS-GL-0007∞/) assert.match(frontend, /桔子 · TCS-GL-0008∞/) assert.match(frontend, /烬舟 · PER-JZ001 · AGE/) assert.match(frontend, /熹微 · PER-JZ-ARCH-001 · AGE/) assert.doesNotMatch(frontend, /肥猫 \+ 烬舟/) assert.match(frontend, /className="gate-close"/) assert.match(frontend, /className="domain-info-scrim"/) assert.match(frontend, /setActiveDomainInfo\(gate\.domain\)/) assert.match(frontend, /event\.key !== 'Escape'/) assert.match(frontend, /编号 \{zeroPoint\?\.userNumber \|\| gateNumber\} · 欢迎登入光湖语言世界/) assert.match(frontend, /createWorldWelcome\(snapshot\)/) assert.match(frontend, /className="world-impression"/) assert.match(frontend, /index === previous/) assert.match(frontend, /核对人格关系/) assert.match(frontend, /确认关系并签署/) assert.match(frontend, /接受责任并签署/) assert.doesNotMatch(frontend, /