test(content-build): cover generated-npc orphan detection in shared npcs dir
This commit is contained in:
@@ -71,3 +71,13 @@ def test_check_ignores_legacy_npc_files(tmp_path):
|
|||||||
(world / "npcs").mkdir(parents=True, exist_ok=True)
|
(world / "npcs").mkdir(parents=True, exist_ok=True)
|
||||||
(world / "npcs" / "legacy.json").write_text('{"id": "legacy"}\n') # bare id
|
(world / "npcs" / "legacy.json").write_text('{"id": "legacy"}\n') # bare id
|
||||||
assert main(argv + ["--check"]) == 0 # legacy file is not a build orphan
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user