zhuyuan-ice-gl-zy001/ZCODE-DEV-20260826/public-spine/shell-frozen-src/scripts/zero-core-numbering-kernel.test.mjs

28 lines
1.4 KiB
JavaScript

import assert from 'node:assert/strict'
import { readFile } from 'node:fs/promises'
import test from 'node:test'
const contractUrl = new URL('../contracts/zero-core-numbering-kernel.json', import.meta.url)
test('zero-core numbering kernel pins the canonical authority map and fails closed', async () => {
const contract = JSON.parse(await readFile(contractUrl, 'utf8'))
assert.equal(contract.schema, 'hololake.zero-core-numbering-kernel/v1')
assert.equal(contract.authority.map_id, 'GH-IDENTITY-AUTHORITY-MAP-001')
assert.equal(contract.authority.source_commit, '104a5d73162bdf4a529701e65898e2bc2863ea9e')
assert.equal(contract.runtime.number_shape_is_authority, false)
assert.equal(contract.runtime.unknown_number, 'FAIL_CLOSED')
assert.equal(contract.runtime.automatic_identity_issuance, false)
})
test('only registered human namespaces can enter a human route', async () => {
const contract = JSON.parse(await readFile(contractUrl, 'utf8'))
const namespaces = Object.fromEntries(contract.namespaces.map((item) => [item.id, item]))
assert.equal(namespaces.ICE_GL.subject_kind, 'FIFTH_DOMAIN_HUMAN')
assert.equal(namespaces.ICE_GL.human_entry, true)
assert.equal(namespaces.TCS_GL.subject_kind, 'ZERO_SENSE_HUMAN_CONTROLLER_TEAM_MEMBER')
assert.equal(namespaces.TCS_GL.human_entry, true)
assert.equal(namespaces.ICE_P.human_entry, false)
assert.equal(namespaces.ICE_BB.human_entry, false)
})