44 lines
2.9 KiB
JavaScript
44 lines
2.9 KiB
JavaScript
import assert from 'node:assert/strict'
|
|
import { readFileSync } from 'node:fs'
|
|
import test from 'node:test'
|
|
|
|
const catalog = JSON.parse(readFileSync(new URL('../contracts/module-donor-admission-registry.json', import.meta.url), 'utf8'))
|
|
const numbered = JSON.parse(readFileSync(new URL('../contracts/numbered-ipc-registry.json', import.meta.url), 'utf8'))
|
|
|
|
test('chaotic donors are read-only candidates and never a bulk merge source', () => {
|
|
assert.equal(catalog.state, 'TWO_CANDIDATES_ADMITTED_REMAINING_DONORS_QUARANTINED')
|
|
assert.equal(catalog.root_rule.repair_old_application_in_place, false)
|
|
assert.equal(catalog.root_rule.bulk_merge_or_wholesale_copy_allowed, false)
|
|
assert.equal(catalog.root_rule.one_candidate_per_admission_cycle, true)
|
|
assert.ok(catalog.donors.every((donor) => donor.state.startsWith('READ_ONLY')))
|
|
})
|
|
|
|
test('candidate coordinates are unique but are not permanent runtime module numbers', () => {
|
|
const coordinates = catalog.candidates.map((candidate) => candidate.candidate_number)
|
|
assert.equal(new Set(coordinates).size, coordinates.length)
|
|
assert.equal(catalog.candidates.filter((candidate) => candidate.state.startsWith('ADMITTED')).length, 2)
|
|
assert.ok(catalog.candidates.slice(2).every((candidate) => candidate.state.startsWith('QUARANTINED')))
|
|
assert.equal(catalog.root_rule.candidate_number_is_runtime_module_number, false)
|
|
assert.equal(catalog.root_rule.permanent_module_number_assignment_before_acceptance, false)
|
|
})
|
|
|
|
test('legacy numbering donor is rejected and the numbered IPC root remains singular', () => {
|
|
const legacy = catalog.rejected_inputs.find((candidate) => candidate.name === 'legacy_numbered_operation_runtime')
|
|
assert.equal(legacy.state, 'REJECTED_SUPERSEDED')
|
|
assert.equal(numbered.runtime.public_tauri_command, 'numbered_ipc')
|
|
assert.equal(numbered.runtime.legacy_direct_commands_allowed, false)
|
|
assert.ok(catalog.admission_gate.includes('ALLOCATE_NUMBERED_IPC_MODULE_TARGET_AND_OPERATION_COORDINATES'))
|
|
assert.ok(catalog.admission_gate.includes('IMPLEMENT_ADAPTER_WITHOUT_RAW_TAURI_INVOKE'))
|
|
})
|
|
|
|
test('hot installation is artifact, permission, self-test and rollback backed', () => {
|
|
assert.equal(catalog.hot_install_boundary.runtime_state, 'SIGNED_DECLARATIVE_PACKAGE_ENGINE_IMPLEMENTED')
|
|
assert.equal(catalog.hot_install_boundary.numbered_module_runtime_operations.length, 9)
|
|
assert.equal(catalog.hot_install_boundary.source_repository_is_directly_executable, false)
|
|
assert.equal(catalog.hot_install_boundary.immutable_signed_artifact_required, true)
|
|
assert.equal(catalog.hot_install_boundary.compatibility_manifest_required, true)
|
|
assert.equal(catalog.hot_install_boundary.rollback_on_self_test_failure, true)
|
|
assert.equal(catalog.hot_install_boundary.user_data_survives_unmount, true)
|
|
assert.equal(catalog.hot_install_boundary.arbitrary_native_code_allowed, false)
|
|
assert.equal(catalog.hot_install_boundary.arbitrary_webview_javascript_allowed, false)
|
|
})
|