2026-08-16 15:10:31 +08:00
|
|
|
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(login, /login_host_for_domain/)
|
2026-08-16 20:27:52 +08:00
|
|
|
assert.match(login, /ENTERPRISE_LOGIN_HOST.*guanghu\.chat/)
|
2026-08-16 20:49:13 +08:00
|
|
|
assert.match(login, /change_enterprise_first_login_password/)
|
|
|
|
|
assert.match(frontend, /第一次使用?先修改一次性密码/)
|
2026-08-16 20:27:52 +08:00
|
|
|
assert.match(router, /enterprise_resolve_url/)
|
2026-08-16 15:10:31 +08:00
|
|
|
assert.match(router, /verified_user_route/)
|
|
|
|
|
assert.match(router, /FIFTH_DOMAIN.*MAIN_DOMAIN.*BRANCH_DOMAIN.*ZERO_DOMAIN.*ZERO_SENSE_DOMAIN/s)
|
|
|
|
|
})
|
|
|
|
|
|
2026-08-16 20:27:52 +08:00
|
|
|
test('enterprise root uses a bounded lighthouse on the current Linux service node', () => {
|
2026-08-16 15:10:31 +08:00
|
|
|
const contract = JSON.parse(read('contracts/domain-number-routing.json'))
|
2026-08-16 20:27:52 +08:00
|
|
|
assert.equal(contract.server_runtime.enterprise_root, 'ENTERPRISE_LIGHTHOUSE_ON_CURRENT_LINUX_SERVICE_NODE')
|
|
|
|
|
assert.equal(contract.server_runtime.linux_role, 'PHYSICAL_SUBSTRATE_AND_SERVICE_SUPERVISOR')
|
2026-08-16 15:10:31 +08:00
|
|
|
assert.equal(contract.server_runtime.ordinary_user_node_requires_full_os_install, false)
|
|
|
|
|
})
|