hololake-system-architecture/product-source/hololake-native-desktop/scripts/domain-number-routing.test.mjs

61 lines
3.4 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 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, /编号 \{zeroPoint\?\.userNumber \|\| gateNumber\} · 欢迎登入光湖语言世界/)
assert.match(frontend, /核对人格关系/)
assert.match(frontend, /确认关系并签署/)
assert.match(frontend, /接受责任并签署/)
assert.doesNotMatch(frontend, /<aside className="sidebar">/)
assert.match(login, /login_host_for_domain/)
assert.match(login, /ENTERPRISE_LOGIN_HOST.*guanghu\.chat/)
assert.match(login, /change_enterprise_first_login_password/)
assert.match(frontend, /第一次使用?先修改一次性密码/)
assert.match(router, /enterprise_resolve_url/)
assert.match(router, /verified_user_route/)
assert.match(router, /FIFTH_DOMAIN.*MAIN_DOMAIN.*BRANCH_DOMAIN.*ZERO_DOMAIN.*ZERO_SENSE_DOMAIN/s)
})
test('the locked Qoder world template is the running client structure, not a skin reference', () => {
const contract = JSON.parse(read('contracts/enterprise-four-domain-entry.json'))
const frontend = read('src/main.tsx')
assert.equal(contract.state, 'SERVER_LIVE_CLIENT_UI_INTEGRATED')
assert.match(contract.ui_template, /official-login-template-v0\.4-locked\+inner-screens-v0\.1/)
assert.match(frontend, /number-nucleus/)
assert.match(frontend, /worldStage === 'domain'/)
assert.match(frontend, /worldStage === 'channel'/)
assert.match(frontend, /worldStage === 'tool'/)
})
test('enterprise root uses a bounded lighthouse on the current Linux service node', () => {
const contract = JSON.parse(read('contracts/domain-number-routing.json'))
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')
assert.equal(contract.server_runtime.ordinary_user_node_requires_full_os_install, false)
})