mirror of
https://github.com/motajs/template.git
synced 2026-10-08 21:40:22 +08:00
test(08-06): align combat tests to shipped interfaces
- remove obsolete addHook(...).load() chains in combat.test.ts (3 sites) - give the special-query buildup fixtures a no-op global aura so the shipped buildupSpecials early-return path reaches the special-query stage - focused combat: 90 passed / 0 failed; perf: 6 passed
This commit is contained in:
parent
59e190b468
commit
71f93a526d
@ -430,16 +430,14 @@ describe('CombatFlow async ordering', () => {
|
||||
const script = new FakeScript(1, 'script', fixture.calls, true);
|
||||
script.gate = gate;
|
||||
fixture.flow.addCombatScript(script);
|
||||
fixture.flow
|
||||
.addHook({
|
||||
onBeforeCombat: async () => {
|
||||
fixture.calls.push('hooks.onBeforeCombat');
|
||||
},
|
||||
onAfterCombat: async () => {
|
||||
fixture.calls.push('hooks.onAfterCombat');
|
||||
}
|
||||
})
|
||||
.load();
|
||||
fixture.flow.addHook({
|
||||
onBeforeCombat: async () => {
|
||||
fixture.calls.push('hooks.onBeforeCombat');
|
||||
},
|
||||
onAfterCombat: async () => {
|
||||
fixture.calls.push('hooks.onAfterCombat');
|
||||
}
|
||||
});
|
||||
|
||||
const running = fixture.flow.battle(fixture.view);
|
||||
await Promise.resolve();
|
||||
@ -462,16 +460,14 @@ describe('CombatFlow async ordering', () => {
|
||||
bindAll(fixture);
|
||||
const script = new FakeScript(1, 'script', fixture.calls, true);
|
||||
fixture.flow.addCombatScript(script);
|
||||
fixture.flow
|
||||
.addHook({
|
||||
onBeforeCombat: async () => {
|
||||
fixture.calls.push('hooks.onBeforeCombat');
|
||||
},
|
||||
onAfterCombat: async () => {
|
||||
fixture.calls.push('hooks.onAfterCombat');
|
||||
}
|
||||
})
|
||||
.load();
|
||||
fixture.flow.addHook({
|
||||
onBeforeCombat: async () => {
|
||||
fixture.calls.push('hooks.onBeforeCombat');
|
||||
},
|
||||
onAfterCombat: async () => {
|
||||
fixture.calls.push('hooks.onAfterCombat');
|
||||
}
|
||||
});
|
||||
|
||||
const info = await fixture.flow.battle(fixture.view);
|
||||
|
||||
@ -490,13 +486,11 @@ describe('CombatFlow async ordering', () => {
|
||||
bindAll(fixture);
|
||||
const script = new FakeScript(1, 'script', fixture.calls, false);
|
||||
fixture.flow.addCombatScript(script);
|
||||
fixture.flow
|
||||
.addHook({
|
||||
onBeforeCombat: async () => {
|
||||
fixture.calls.push('hooks.onBeforeCombat');
|
||||
}
|
||||
})
|
||||
.load();
|
||||
fixture.flow.addHook({
|
||||
onBeforeCombat: async () => {
|
||||
fixture.calls.push('hooks.onBeforeCombat');
|
||||
}
|
||||
});
|
||||
|
||||
await fixture.flow.battle(fixture.view);
|
||||
|
||||
|
||||
@ -541,6 +541,15 @@ describe('EnemyContext converters and effect registrations', () => {
|
||||
const fixture = createContextFixture();
|
||||
fixture.context.bindHero(fixture.hero);
|
||||
fixture.context.setEnemyAt({ x: 0, y: 0 }, createEnemy('e1'));
|
||||
// shipped 的 buildupSpecials 在无光环时会提前返回
|
||||
// 故放置一个无副作用全局光环,使构建进入特殊查询阶段
|
||||
fixture.context.addAura(
|
||||
new FakeAura({
|
||||
priority: 1,
|
||||
range: new modules.FullRange(),
|
||||
param: undefined
|
||||
})
|
||||
);
|
||||
const forCalls: number[] = [];
|
||||
const modifier = {
|
||||
add: () => [],
|
||||
@ -1421,6 +1430,15 @@ describe('EnemyContext refresh paths and DEV warnings', () => {
|
||||
const fixture = createContextFixture();
|
||||
fixture.context.bindHero(fixture.hero);
|
||||
fixture.context.setEnemyAt({ x: 0, y: 0 }, createEnemy('e1'));
|
||||
// shipped 的 buildupSpecials 在无光环时会提前返回
|
||||
// 故放置一个无副作用全局光环,使构建进入特殊查询阶段
|
||||
fixture.context.addAura(
|
||||
new FakeAura({
|
||||
priority: 1,
|
||||
range: new modules.FullRange(),
|
||||
param: undefined
|
||||
})
|
||||
);
|
||||
const modifier = {
|
||||
add: () => [createSpecial(30) as never],
|
||||
delete: () => [createSpecial(31) as never],
|
||||
|
||||
Loading…
Reference in New Issue
Block a user