31 lines
1.7 KiB
JavaScript
31 lines
1.7 KiB
JavaScript
|
|
import assert from 'node:assert/strict'
|
||
|
|
import { readFile } from 'node:fs/promises'
|
||
|
|
import test from 'node:test'
|
||
|
|
|
||
|
|
const registryUrl = new URL('../contracts/gls-runtime-registry.json', import.meta.url)
|
||
|
|
|
||
|
|
test('compiled GLS registry inventories every current numbered protocol without executing raw text', async () => {
|
||
|
|
const registry = JSON.parse(await readFile(registryUrl, 'utf8'))
|
||
|
|
|
||
|
|
assert.equal(registry.schema, 'hololake.gls-protocol-runtime-registry/v1')
|
||
|
|
assert.equal(registry.source.repository, 'REPO-012')
|
||
|
|
assert.equal(registry.source.commit, '2598fbfba8caf64c7ab9740a3036c5aab977502e')
|
||
|
|
assert.equal(registry.compiler.raw_protocol_text_executed, false)
|
||
|
|
assert.equal(registry.compiler.arbitrary_protocol_code_allowed, false)
|
||
|
|
assert.equal(registry.compiler.unprojected_protocol_behavior, 'INVENTORIED_NOT_EXECUTABLE')
|
||
|
|
assert.equal(registry.protocol_count, 75)
|
||
|
|
assert.equal(new Set(registry.protocols.map((protocol) => protocol.id)).size, 75)
|
||
|
|
assert.ok(registry.protocols.every((protocol) => /^[a-f0-9]{64}$/.test(protocol.source_sha256)))
|
||
|
|
})
|
||
|
|
|
||
|
|
test('only explicit deterministic projections enter the runtime enforcement set', async () => {
|
||
|
|
const registry = JSON.parse(await readFile(registryUrl, 'utf8'))
|
||
|
|
const protocols = Object.fromEntries(registry.protocols.map((protocol) => [protocol.id, protocol]))
|
||
|
|
|
||
|
|
assert.equal(protocols['GLS-0253'].projection_state, 'EXECUTABLE_PROJECTION')
|
||
|
|
assert.equal(protocols['GLS-0253'].adapter, 'zero-core-numbering')
|
||
|
|
assert.ok(protocols['GLS-0253'].event_kinds.includes('IDENTITY_ROUTE'))
|
||
|
|
assert.equal(protocols['GLS-0003'], undefined)
|
||
|
|
assert.equal(registry.executable_projection_count, 4)
|
||
|
|
assert.equal(registry.inventoried_not_executable_count, 71)
|
||
|
|
})
|