Expose typed Eve surfaces beyond loopback

This commit is contained in:
Meta Vens 2026-08-25 03:56:53 +02:00
commit a8db89d961
2 changed files with 47 additions and 22 deletions

View file

@ -6,10 +6,18 @@ const test = require("node:test");
const {
createBrowserCatalog,
findProviderCdnRoute,
hermodrRudpPeerOptions,
normalizeProviderAdvertisement,
normalizeSurfaceState,
surfaceRecordKeys,
} = require("../src/hermodr-daemon.cjs");
test("Hermodr outbound RUDP peers bind beyond loopback", () => {
const options = hermodrRudpPeerOptions();
assert.equal(options.bindHost, "0.0.0.0");
assert.equal(options.connectTimeoutMs, 2_000);
});
const provider = normalizeProviderAdvertisement({
providerId: "fixture.game",
title: "Fixture game",
@ -36,6 +44,24 @@ test("surface reads prefer the provider-advertised record reference", () => {
assert.equal(surfaceRecordKeys(catalog, "fixture.game", "fixture.world")[0], "cultmesh://fixture/surfaces/world");
});
test("surface-state normalization lowers MessagePack array records", () => {
const state = normalizeSurfaceState([
"gjallar.overview",
"Gjallar",
7,
"2026-08-25T00:00:00Z",
[
"gjallar.overview.surface",
["root", "dashboard", { title: "Gjallar" }, [], [], [], { mode: "weighted-bisect" }, {}],
[],
],
], "gjallar.overview");
assert.equal(state.surface.id, "gjallar.overview.surface");
assert.equal(state.surface.root.kind, "dashboard");
assert.equal(state.surface.root.layout.mode, "weighted-bisect");
});
test("CDN routing follows the asset URI provider instead of a product name", () => {
const catalog = createBrowserCatalog([provider]);
const route = findProviderCdnRoute(catalog, "cultmesh://fixture.game/assets/player");