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 readText = (relative) => fs.readFileSync(path.join(root, relative), 'utf8') const readJson = (relative) => JSON.parse(readText(relative)) test('the native user PNCC contract binds verified number, signed-in account and embedded Git', () => { const contract = readJson('contracts/user-pncc-channel.json') assert.equal(contract.engine, 'GIT') assert.equal(contract.human_projection, 'HOLOLAKE_NATIVE') assert.equal(contract.forgejo_role, 'OPTIONAL_REMOTE_COLLABORATION_ADAPTER') assert.equal(contract.binding.requires_verified_user_number, true) assert.equal(contract.binding.domain_resolved_before_login, true) assert.equal(contract.binding.domain_specific_login_and_node_entry_required, true) assert.equal(contract.binding.requires_authenticated_repository_account, true) assert.equal(contract.binding.password_written_to_repository, false) assert.equal(contract.binding.persona_binding_claimed, false) assert.equal(contract.local_repository.automatic_idempotent_initialization, true) }) test('the user PNCC is a native command and first-class HoloLake projection', () => { const native = readText('src-tauri/src/lib.rs') const frontend = readText('src/main.tsx') assert.match(native, /user_pncc_channel::get_user_pncc_channel/) assert.match(native, /user_pncc_channel::ensure_user_pncc_channel/) assert.match(frontend, /GH-PNCC · 人格原生代码频道/) assert.match(frontend, /Forgejo 协作适配器/) assert.match(frontend, /ensure_user_pncc_channel/) assert.doesNotMatch(frontend, /Forgejo 页面/) })