From e72231d9fab00224a566c1a235de058396d7ebc3 Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Mon, 14 Sep 2026 13:35:51 +0800 Subject: [PATCH] test(06-02): close GuardAura converter and capability coverage gap - add a normal case for GuardAuraConverter.convert (code 26 -> GuardAura) - assert GuardAura priority/couldApplyBase/couldApplySpecial/range/applySpecial - keeps D-30 per-public-method coverage symmetric with CommonAura --- .../data-state/src/enemy/aura.test.ts | 40 ++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/packages-user/data-state/src/enemy/aura.test.ts b/packages-user/data-state/src/enemy/aura.test.ts index 7a930f1..139f30b 100644 --- a/packages-user/data-state/src/enemy/aura.test.ts +++ b/packages-user/data-state/src/enemy/aura.test.ts @@ -314,7 +314,7 @@ describe('CommonAura apply', () => { }); }); -describe('GuardAura', () => { +describe('GuardAuraConverter', () => { // 验证只有代码 26 的特殊属性会被支援光环转换器接管 it('converts only special code 26', () => { const converter = new modules.GuardAuraConverter(); @@ -327,6 +327,27 @@ describe('GuardAura', () => { ).toBe(false); }); + // 验证转换结果为携带上下文、怪物、特殊属性与定位符的支援光环视图 + it('converts a code 26 special into a guard aura', () => { + const converter = new modules.GuardAuraConverter(); + const { enemy } = createEnemy(); + const locator: ITileLocator = { x: 3, y: 4 }; + const special = createSpecial(26, undefined); + + const aura = converter.convert( + special, + createReadonlyHandler(enemy, locator), + createContext(() => createView()) + ); + + expect(aura).toBeInstanceOf(modules.GuardAura); + expect(aura.enemy).toBe(enemy); + expect(aura.locator).toBe(locator); + expect(aura.special).toBe(special); + }); +}); + +describe('GuardAura', () => { // 验证支援光环的范围参数为以定位符为中心的 3x3 矩形 it('uses a 3x3 rect centered on the locator', () => { const { enemy } = createEnemy(); @@ -391,4 +412,21 @@ describe('GuardAura', () => { expect(target.attrs.guard.size).toBe(0); }); + + // 验证支援光环的优先级与修饰能力声明,且不产生特殊属性修饰器 + it('reports its priority, capabilities and no special modifier', () => { + const { enemy } = createEnemy(); + const aura = new modules.GuardAura( + createContext(() => createView()), + enemy, + createSpecial(26, undefined), + { x: 1, y: 1 } + ); + + expect(aura.priority).toBe(26); + expect(aura.couldApplyBase).toBe(true); + expect(aura.couldApplySpecial).toBe(false); + expect(aura.range).toBeInstanceOf(modules.RectRange); + expect(aura.applySpecial()).toBeNull(); + }); });