From c09b6e89a0b126e334f567b5da6194c55808e1c1 Mon Sep 17 00:00:00 2001 From: Phillip Tarrant Date: Sat, 11 Jul 2026 19:06:00 -0500 Subject: [PATCH] test(content-build): cover generated-npc orphan detection in shared npcs dir --- tools/content_build/tests/test_cli.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/content_build/tests/test_cli.py b/tools/content_build/tests/test_cli.py index 4d30bf9..e2bb1ad 100644 --- a/tools/content_build/tests/test_cli.py +++ b/tools/content_build/tests/test_cli.py @@ -71,3 +71,13 @@ def test_check_ignores_legacy_npc_files(tmp_path): (world / "npcs").mkdir(parents=True, exist_ok=True) (world / "npcs" / "legacy.json").write_text('{"id": "legacy"}\n') # bare id assert main(argv + ["--check"]) == 0 # legacy file is not a build orphan + + +def test_check_detects_orphan_generated_npc(tmp_path): + lore = _lore(tmp_path) + world, server = tmp_path / "world", tmp_path / "server" + argv = ["--lore", str(lore), "--world", str(world), "--server", str(server)] + assert main(argv) == 0 + (world / "npcs").mkdir(parents=True, exist_ok=True) + (world / "npcs" / "ghost.json").write_text('{"id": "npc.ghost"}\n') + assert main(argv + ["--check"]) == 1 # a generated npc.* orphan in the shared dir IS caught