From e55db834ab287c3904bf1917f9e3bf87a8c52592 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Sat, 25 Apr 2026 16:32:02 +0200 Subject: [PATCH] Feat: Add 'Above' NPC entity and related interaction tests --- tests/unit/runtime-host.test.ts | 46 ++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/tests/unit/runtime-host.test.ts b/tests/unit/runtime-host.test.ts index 78198ded..a5f339c1 100644 --- a/tests/unit/runtime-host.test.ts +++ b/tests/unit/runtime-host.test.ts @@ -3245,6 +3245,15 @@ describe("RuntimeHost", () => { name: "Right", defaultDialogueId: null, dialogues: [] + }, + { + entityId: "npc-above", + visible: true, + position: { x: 0, y: 2, z: 5 }, + collider: { mode: "capsule", radius: 0.35, height: 1.8, eyeHeight: 1.6 }, + name: "Above", + defaultDialogueId: null, + dialogues: [] } ], interactables: [], @@ -3252,7 +3261,8 @@ describe("RuntimeHost", () => { }, interactionLinks: [ { id: "link-active", sourceEntityId: "npc-active", trigger: "click", action: { type: "runSequence", sequenceId: "noop" } }, - { id: "link-right", sourceEntityId: "npc-right", trigger: "click", action: { type: "runSequence", sequenceId: "noop" } } + { id: "link-right", sourceEntityId: "npc-right", trigger: "click", action: { type: "runSequence", sequenceId: "noop" } }, + { id: "link-above", sourceEntityId: "npc-above", trigger: "click", action: { type: "runSequence", sequenceId: "noop" } } ] } as never; hostInternals.activeController = hostInternals.thirdPersonController; @@ -3271,6 +3281,12 @@ describe("RuntimeHost", () => { entityId: "npc-right", center: { x: 2, y: 0.9, z: 5 }, score: 2.5 + }, + { + kind: "npc", + entityId: "npc-above", + center: { x: 0, y: 2.9, z: 5 }, + score: 2.4 } ]; hostInternals.activeRuntimeTargetReference = { @@ -3312,6 +3328,34 @@ describe("RuntimeHost", () => { kind: "npc", entityId: "npc-right" }); + expect( + hostInternals.handleRuntimeTargetLookInput({ + horizontal: 0, + vertical: 0 + }) + ).toEqual({ + activeTargetLocked: true, + switchedTarget: false, + switchInputHeld: false + }); + hostInternals.activeRuntimeTargetReference = { + kind: "npc", + entityId: "npc-active" + }; + expect( + hostInternals.handleRuntimeTargetLookInput({ + horizontal: 0, + vertical: 1 + }) + ).toEqual({ + activeTargetLocked: true, + switchedTarget: true, + switchInputHeld: true + }); + expect(hostInternals.activeRuntimeTargetReference).toEqual({ + kind: "npc", + entityId: "npc-above" + }); host.dispose(); });