The lab cloned and installed from the owner this mesh's repositories are under, written in its code; another mesh's forge holds them under its own (1838/AC4). Unset, lab_check, lab_run and a rebuild say so. Fixtures name neutral machines and an example owner.
27 lines
1.4 KiB
TypeScript
27 lines
1.4 KiB
TypeScript
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<string, Record<string, unknown>> };
|
|
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);
|
|
}
|
|
});
|