mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-04 23:42:18 +02:00
Stop on EndEvolutionPhase
to prevent game state leak in tests
This commit is contained in:
parent
622e077520
commit
7101f4f0fa
@ -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);
|
||||
});
|
||||
|
@ -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 = [
|
||||
|
Loading…
Reference in New Issue
Block a user