From 4bd6a463d6fbfe815bfca531427bcfb6fa76aa01 Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Fri, 11 Sep 2026 22:22:21 +0800 Subject: [PATCH] test(03-17): cover replay registry construction - Assert direct stable registry construction - Guard against formatter suppressions and duplicate directional classes - Retain deferred movement and pathfinding ordering coverage --- .../data-state/src/replay/commands.test.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages-user/data-state/src/replay/commands.test.ts b/packages-user/data-state/src/replay/commands.test.ts index 771fd07..63f82be 100644 --- a/packages-user/data-state/src/replay/commands.test.ts +++ b/packages-user/data-state/src/replay/commands.test.ts @@ -139,6 +139,24 @@ describe('replay commands', () => { ); }); + // 验证稳定 registry 使用直接构造且不依赖手工 formatter 抑制 + it('keeps registry construction direct and formatter-normalized', () => { + const source = readFileSync( + new URL('./commands.ts', import.meta.url), + 'utf8' + ); + expect(source).not.toContain('prettier-ignore'); + expect(source).toContain( + 'command: new ReplayDirectionCommand(state, FaceDirection.Up)' + ); + expect(source).toContain( + 'command: new ReplayAutoPathfindCommand(state)' + ); + expect(source).toContain('command: new ReplayUseItemCommand(state)'); + expect(source).toContain('command: new ReplayEquipCommand(state)'); + expect(source).toContain('command: new ReplayUnequipCommand(state)'); + }); + // 验证四向移动等待 controller.onEnd 后才完成 command 并进入下一步 it('awaits directional movement before the next replay step', async () => { const state = createCoreState();