From 4128380a3d828f4da66a606c78fed0e8af2949f0 Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 4 Oct 2026 01:21:40 +0200 Subject: [PATCH] audit-logger: its test subscribes as the module does and expects local event names The test subscribed '**', which its in-memory broker never matched, while the module subscribes '#'; and it still expected the module-qualified type from before event names became local. --- modules/audit-logger/test/audit.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/audit-logger/test/audit.test.ts b/modules/audit-logger/test/audit.test.ts index db09111..b7d3dee 100644 --- a/modules/audit-logger/test/audit.test.ts +++ b/modules/audit-logger/test/audit.test.ts @@ -15,7 +15,7 @@ test("audit-logger records every event to the trail as one line each", async () const path = join(dir, "audit.log"); // The audit-logger's whole behaviour: consume everything, record it. - await on("**", async (event) => record(event, path)); + await on("#", async (event) => record(event, path)); // the pattern index.ts subscribes process.env.MESH_MODULE = "umami"; process.env.MESH_NODE = "anchor"; @@ -24,7 +24,9 @@ test("audit-logger records every event to the trail as one line each", async () const lines = (await readFile(path, "utf8")).trim().split("\n").map((l) => JSON.parse(l)); assert.equal(lines.length, 2); - assert.deepEqual(lines.map((l) => l.type), ["umami.site.created", "node.anchor.joined"]); + // A module names its events locally (design 29); the module is the `source`, which together with + // the type says whose event it was. This broker does no namespacing, so the type is as emitted. + assert.deepEqual(lines.map((l) => l.type), ["site.created", "node.anchor.joined"]); assert.equal(lines[0].source, "umami"); assert.equal(lines[0].node, "anchor"); assert.equal(lines[0].body.domain, "my-app");