Full SDK workspace: core, contracts, sdk, cli, browser-host, browser-kit, federation, omega-core, oracle, self-healing, strategies, tools, emacs. Clean extraction from the development monorepo. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
22 lines
919 B
TypeScript
22 lines
919 B
TypeScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { getLegacyIngressTopic, extractLegacyRealmFromIngressTopic, getMxIngressTopic, extractMxIngressFromTopic, getInternalTopic } from '@open-matrix/federation/topics';
|
|
|
|
test('legacy ingress roundtrip', () => {
|
|
const realm = 'flowpad-demo.tab-01';
|
|
const t = getLegacyIngressTopic(realm);
|
|
assert.ok(t.startsWith('public.ingress.'));
|
|
assert.equal(extractLegacyRealmFromIngressTopic(t), realm);
|
|
});
|
|
|
|
test('mx ingress roundtrip', () => {
|
|
const t = getMxIngressTopic('acme.com', '00');
|
|
assert.equal(t, 'acme.com.$ingress.00');
|
|
assert.deepEqual(extractMxIngressFromTopic(t), { root: 'acme.com', shard: '00' });
|
|
});
|
|
|
|
test('internal topic returns semantic path directly', () => {
|
|
const t = getInternalTopic('matrix-3', 'env/prod/root.ui.app.editor.accepts.setText');
|
|
assert.equal(t, 'env/prod/root.ui.app.editor.accepts.setText');
|
|
});
|