Block registry api

This commit is contained in:
2026-11-12 20:41:13 -03:00
parent e7fe663746
commit 76802ed430
39 changed files with 499 additions and 100 deletions
+3 -3
View File
@@ -259,11 +259,11 @@ async function setup() {
return { ...t, dir };
}
Deno.test("check-mods catches loot tables that point at nothing", () => {
Deno.test("check-mods catches loot tables that point at nothing", async () => {
const dir = Deno.makeTempDirSync({ prefix: "bworld_loot_check_" });
copy_dir("mods/bworld", `${dir}/bworld`);
loot_mod(dir);
const ok = load_and_check(dir).find((mod) => mod.id === "testloot")!;
const ok = (await load_and_check(dir)).find((mod) => mod.id === "testloot")!;
assertEquals(ok.report.errors, []);
assertEquals(ok.loot_tables.map((t) => t.json.id).sort(), [
"testloot:blocks/ore",
@@ -280,7 +280,7 @@ Deno.test("check-mods catches loot tables that point at nothing", () => {
},
}),
);
const errors = load_and_check(dir).find((mod) => mod.id === "testloot")!.report.errors;
const errors = (await load_and_check(dir)).find((mod) => mod.id === "testloot")!.report.errors;
assert(errors.some((e) => e.includes("item testloot:nothing doesn't exist")), errors.join("\n"));
assert(errors.some((e) => e.includes("loot table testloot:nowhere doesn't exist")), errors.join("\n"));
Deno.removeSync(dir, { recursive: true });