From 64c3cd487e0e93a500dce9d8c6ec9ee6ef5d1b44 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Tue, 14 Apr 2026 20:34:36 +0200 Subject: [PATCH] Add test for NPC dialogue references to missing dialogue resources --- .../domain/scene-document-validation.test.ts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/domain/scene-document-validation.test.ts b/tests/domain/scene-document-validation.test.ts index 0a5b3fe2..c2daea6a 100644 --- a/tests/domain/scene-document-validation.test.ts +++ b/tests/domain/scene-document-validation.test.ts @@ -219,6 +219,27 @@ describe("validateSceneDocument", () => { ); }); + it("rejects NPC dialogue references that point to missing dialogue resources", () => { + const npc = createNpcEntity({ + id: "entity-npc-guide", + actorId: "actor-guide", + dialogueId: "dialogue-missing" + }); + const document = createEmptySceneDocument(); + document.entities[npc.id] = npc; + + const validation = validateSceneDocument(document); + + expect(validation.errors).toEqual( + expect.arrayContaining([ + expect.objectContaining({ + code: "missing-dialogue-resource", + path: `entities.${npc.id}.dialogueId` + }) + ]) + ); + }); + it("accepts typed scheduler light control effects in the scene document", () => { const pointLight = createPointLightEntity({ id: "entity-point-light-main",