From 073e009816765605564508a2362598b4e587b5fa Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Wed, 9 Sep 2026 10:59:02 +0800 Subject: [PATCH] test(01-11): cover legacy map event dispatch - prove an existing point-event id reaches the mover executor\n- assert PointEvent source and approved locator environment --- .../src/event/eventDispatch.test.ts | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/packages-user/data-system/src/event/eventDispatch.test.ts b/packages-user/data-system/src/event/eventDispatch.test.ts index dc73dd2..1d112f8 100644 --- a/packages-user/data-system/src/event/eventDispatch.test.ts +++ b/packages-user/data-system/src/event/eventDispatch.test.ts @@ -104,7 +104,7 @@ function createFixture( eventSystem: { executor } }; const mover = new modules.DefaultHeroMoveTopImpl(state); - return { events, executor, layer, dynamic, mover, state }; + return { events, executor, layer, map: map!, dynamic, mover, state }; } function addEvent( @@ -144,6 +144,38 @@ function invocation(id: string, trigger: number) { } describe('source-aware matching dispatch', () => { + it('executes a map-bound point id through the event layer and mover', async () => { + const calls: EventCall[] = []; + const fixture = createFixture({ 1: { 50: 'legacy-point-enter' } }); + addEvent( + fixture.events, + 'legacy-point-enter', + modules.EventTrigger.OnEnter, + true, + calls + ); + + expect(fixture.map.eventLayer).toBe(fixture.layer); + await fixture.mover.enter({ + state: fixture.state, + currLoc: { x: 0, y: 0 }, + nextLoc: { x: 1, y: 0 }, + direction: 0, + floorId: 'F1', + face: new modules.Dir8FaceHandler() + }); + + expect(calls).toHaveLength(1); + expect(calls[0]).toMatchObject({ + id: 'legacy-point-enter', + trigger: modules.EventTrigger.OnEnter, + type: modules.BlockEventType.PointEvent, + tile: null, + hero: { x: 1, y: 0 }, + triggerLocator: { x: 1, y: 0 } + }); + }); + it('source-aware matching dispatch', async () => { const calls: EventCall[] = []; const fixture = createFixture({