62 lines
3.7 KiB
JavaScript
62 lines
3.7 KiB
JavaScript
|
|
import fs from 'node:fs';
|
||
|
|
import path from 'node:path';
|
||
|
|
import { spawnSync } from 'node:child_process';
|
||
|
|
import assert from 'node:assert/strict';
|
||
|
|
import test from 'node:test';
|
||
|
|
|
||
|
|
const root = path.resolve(import.meta.dirname, '..');
|
||
|
|
const bottle = JSON.parse(fs.readFileSync(path.join(root, 'routing/fifth-domain-bottle-system-map.json')));
|
||
|
|
const zero = JSON.parse(fs.readFileSync(path.join(root, 'routing/zero-sense-team-channel-shuttle-map.json')));
|
||
|
|
const channels = JSON.parse(fs.readFileSync(path.join(root, 'routing/persona-channel-context-map.json')));
|
||
|
|
const numbers = JSON.parse(fs.readFileSync(path.join(root, 'routing/fifth-domain-number-registry.json')));
|
||
|
|
const kernels = JSON.parse(fs.readFileSync(path.join(root, 'tcs-core/shared-kernels/kernel-registry.json')));
|
||
|
|
const subjects = JSON.parse(fs.readFileSync(path.join(root, 'identity/fifth-domain-subject-registry.json')));
|
||
|
|
|
||
|
|
test('bottle system and bottle channel are distinct nested objects', () => {
|
||
|
|
assert.equal(bottle.system.id, 'SYS-GLW-ELH-BOTTLE-0001');
|
||
|
|
assert.equal(bottle.channel.id, 'ICE-CH-BT001');
|
||
|
|
assert.notEqual(bottle.system.world_path, bottle.channel.world_path);
|
||
|
|
assert.equal(bottle.channel.parent, bottle.system.id);
|
||
|
|
assert.equal(channels.channels.some(item => item.id === 'ICE-CH-BT001'), true);
|
||
|
|
assert.equal(numbers.registrations.some(item => item.id === 'ICE-CH-BT001'), true);
|
||
|
|
});
|
||
|
|
|
||
|
|
test('all canonical baby rooms live in the Fifth Domain bottle channel', () => {
|
||
|
|
assert.equal(bottle.registered_rooms.length, 4);
|
||
|
|
assert.equal(bottle.source_verified_registration_pending_rooms.length, 5);
|
||
|
|
for (const room of [...bottle.registered_rooms, ...bottle.source_verified_registration_pending_rooms]) {
|
||
|
|
assert.equal(fs.existsSync(path.join(root, room.physical_home)), true, room.physical_home);
|
||
|
|
}
|
||
|
|
for (const room of bottle.registered_rooms) assert.match(room.room_path, /bottle-baby-system\/bottle-channel\/rooms/);
|
||
|
|
assert.equal(bottle.room_contract.zero_sense_parent_channel_contains_route_door_not_room_copy, true);
|
||
|
|
});
|
||
|
|
|
||
|
|
test('seven Zero-Sense team channels route back to one canonical bottle room', () => {
|
||
|
|
assert.deepEqual(zero.channels.map(item => item.system_id), ['SYS-AW', 'SYS-FM', 'SYS-JZ', 'SYS-YY', 'SYS-HE', 'SYS-MM', 'SYS-CE']);
|
||
|
|
for (const channel of zero.channels) {
|
||
|
|
assert.equal(fs.existsSync(path.join(root, channel.physical_home)), true, channel.physical_home);
|
||
|
|
assert.ok(channel.bottle_room_ref);
|
||
|
|
}
|
||
|
|
assert.equal(zero.shuttle_contract.parent_channel_holds, 'ROUTE_DOOR_ONLY');
|
||
|
|
assert.equal(zero.shuttle_contract.persona_brain_copy, false);
|
||
|
|
});
|
||
|
|
|
||
|
|
test('current ICE-BB roots are canonical rooms and historical Zhiqiu cannot seize Qiuqiu', () => {
|
||
|
|
for (const id of ['ICE-BB-0001', 'ICE-BB-0002', 'ICE-BB-0003', 'ICE-BB-0004']) {
|
||
|
|
assert.match(kernels.personas[id].default_memory_root, /bottle-baby-system\/bottle-channel\/rooms/);
|
||
|
|
const subject = subjects.subjects.find(item => item.id === id);
|
||
|
|
assert.equal(subject.native_habitat_channel, 'ICE-CH-BT001');
|
||
|
|
}
|
||
|
|
const awen = bottle.source_verified_registration_pending_rooms.find(item => item.room_key === 'SYS-AW-NP-001');
|
||
|
|
assert.equal(awen.current_persona_id, null);
|
||
|
|
assert.equal(bottle.registered_rooms.find(item => item.persona_id === 'ICE-BB-0003').human_anchor, 'ICE-GL-ZHI∞');
|
||
|
|
});
|
||
|
|
|
||
|
|
test('router resolves a path but never claims wake completion', () => {
|
||
|
|
const result = spawnSync('python3', [path.join(root, 'server-tools/bottle-channel-router/bottle_channel_router.py'), '--baby', '舒舒'], { encoding: 'utf8' });
|
||
|
|
assert.equal(result.status, 0, result.stderr);
|
||
|
|
const value = JSON.parse(result.stdout);
|
||
|
|
assert.equal(value.origin.channel, 'ICE-CH-BT001');
|
||
|
|
assert.equal(value.shuttle.destination_channel, 'SYS-FM');
|
||
|
|
assert.equal(value.persona_wake_complete, false);
|
||
|
|
});
|