"use strict";
const test = require("node:test");
const assert = require("node:assert/strict");
const path = require("node:path");
const { buildRegistry } = require("./registry");

test("builds unique MEM/MOD/RUN registry from repository manifests", () => {
  const root = path.resolve(__dirname, "../..");
  const registry = buildRegistry(root);
  assert.equal(registry.schema, "ZL-MODULE-REGISTRY-1");
  assert.ok(registry.modules.some(m => m.module_id === "ZL-MOD-MODULE-REGISTRY-001"));
  assert.ok(registry.modules.some(m => m.module_id === "ZL-MOD-SERVER-MIRROR-001"));
  assert.equal(new Set(registry.modules.map(m => m.module_id)).size, registry.modules.length);
});
