import { test } from "node:test"; import assert from "node:assert/strict"; import { readdirSync, readFileSync } from "node:fs"; import { join } from "node:path"; // The forge's owner differs between meshes (novox/hq ADR 0507 ยง9, issue 1838): the lab takes it as a config value // the operator gives, with no default, and no file of the lab names it. // 1838/AC4 const here = join(import.meta.dirname, ".."); test("the forge's owner is a required config value with no default, and reaches the lab's env-file", () => { const manifest = JSON.parse(readFileSync(join(here, "module.json"), "utf8")) as { config: Record> }; const owner = manifest.config["forge-owner"]; assert.ok(owner, "the manifest declares no forge-owner"); assert.equal(owner.required, true); assert.ok(!("default" in owner), `forge-owner has the default ${JSON.stringify(owner.default)}`); assert.match(readFileSync(join(here, "files", "lab.env"), "utf8"), /^MESH_LAB_FORGE_OWNER=\$\{config:forge-owner\}$/m); }); test("no file of the lab's code names an owner on the forge", () => { for (const f of readdirSync(join(here, "tools")).filter((f) => f.endsWith(".ts"))) { const src = readFileSync(join(here, "tools", f), "utf8"); assert.doesNotMatch(src, /\}\/[a-z][\w.-]*\/\$\{repo\}|\}\/[a-z][\w.-]*\/mesh-lab\.git|\/api\/packages\/[a-z][\w.-]*\/npm\//, f); } });