diff --git a/src/test/evolution.test.ts b/src/test/evolution.test.ts index 319ce7f9d7a..3faad179617 100644 --- a/src/test/evolution.test.ts +++ b/src/test/evolution.test.ts @@ -114,7 +114,7 @@ describe("Evolution", () => { expect(golem.hp).toBe(1); game.doAttack(getMovePosition(game.scene, 0, Moves.SURF)); - await game.phaseInterceptor.to("EvolutionPhase"); + await game.phaseInterceptor.to("EndEvolutionPhase"); expect(totodile.hp).toBe(totodile.getMaxHp()); expect(totodile.hp).toBeGreaterThan(hpBefore); @@ -125,17 +125,17 @@ describe("Evolution", () => { .enemySpecies(Species.GOLEM) .enemyMoveset(SPLASH_ONLY) .startingWave(21) - .startingLevel(16) - .enemyLevel(50); + .startingLevel(13) + .enemyLevel(30); - await game.startBattle([Species.TOTODILE]); + await game.startBattle([Species.CYNDAQUIL]); - const totodile = game.scene.getPlayerPokemon()!; - totodile.hp = totodile.getMaxHp() / 2; - const hpBefore = totodile.hp; - const maxHpBefore = totodile.getMaxHp(); + const cyndaquil = game.scene.getPlayerPokemon()!; + cyndaquil.hp = Math.floor(cyndaquil.getMaxHp() / 2); + const hpBefore = cyndaquil.hp; + const maxHpBefore = cyndaquil.getMaxHp(); - expect(totodile.hp).toBe(totodile.getMaxHp() / 2); + expect(cyndaquil.hp).toBe(Math.floor(cyndaquil.getMaxHp() / 2)); const golem = game.scene.getEnemyPokemon()!; golem.hp = 1; @@ -143,10 +143,10 @@ describe("Evolution", () => { expect(golem.hp).toBe(1); game.doAttack(getMovePosition(game.scene, 0, Moves.SURF)); - await game.phaseInterceptor.to("EvolutionPhase"); + await game.phaseInterceptor.to("EndEvolutionPhase"); - expect(totodile.getMaxHp()).toBeGreaterThan(maxHpBefore); - expect(totodile.hp).toBeGreaterThan(hpBefore); - expect(totodile.hp).toBeLessThan(totodile.getMaxHp()); + expect(cyndaquil.getMaxHp()).toBeGreaterThan(maxHpBefore); + expect(cyndaquil.hp).toBeGreaterThan(hpBefore); + expect(cyndaquil.hp).toBeLessThan(cyndaquil.getMaxHp()); }, TIMEOUT); }); diff --git a/src/test/utils/phaseInterceptor.ts b/src/test/utils/phaseInterceptor.ts index d404afe04d4..f09b63fc846 100644 --- a/src/test/utils/phaseInterceptor.ts +++ b/src/test/utils/phaseInterceptor.ts @@ -38,7 +38,7 @@ import UI, { Mode } from "#app/ui/ui"; import { Phase } from "#app/phase"; import ErrorInterceptor from "#app/test/utils/errorInterceptor"; import { QuietFormChangePhase } from "#app/form-change-phase"; -import { EvolutionPhase } from "#app/evolution-phase.js"; +import { EndEvolutionPhase, EvolutionPhase } from "#app/evolution-phase.js"; export default class PhaseInterceptor { public scene; @@ -94,6 +94,7 @@ export default class PhaseInterceptor { [SwitchPhase, this.startPhase], [SwitchSummonPhase, this.startPhase], [EvolutionPhase, this.startPhase], + [EndEvolutionPhase, this.startPhase], ]; private endBySetMode = [