Update spies in type-change ability tests

This commit is contained in:
Sirz Benjie 2025-04-18 21:06:19 -05:00
parent 756a9ec017
commit 2211b3bec7
No known key found for this signature in database
GPG Key ID: 4A524B4D196C759E

View File

@ -88,10 +88,10 @@ describe.each([
await game.classicMode.startBattle();
const playerPokemon = game.scene.getPlayerPokemon()!;
vi.spyOn(playerPokemon, "getMoveType");
const tySpy = vi.spyOn(playerPokemon, "getMoveType");
const enemyPokemon = game.scene.getEnemyPokemon()!;
vi.spyOn(enemyPokemon, "apply");
const enemyApplySpy = vi.spyOn(enemyPokemon, "apply");
enemyPokemon.hp = Math.floor(enemyPokemon.getMaxHp() * 0.8);
@ -99,9 +99,12 @@ describe.each([
await game.phaseInterceptor.to("BerryPhase", false);
expect(playerPokemon.getMoveType).toHaveLastReturnedWith(PokemonType.ELECTRIC);
expect(enemyPokemon.apply).toHaveReturnedWith(HitResult.NO_EFFECT);
expect(tySpy).toHaveLastReturnedWith(PokemonType.ELECTRIC);
expect(enemyApplySpy).toHaveReturnedWith(HitResult.NO_EFFECT);
expect(enemyPokemon.hp).toBe(enemyPokemon.getMaxHp());
tySpy.mockRestore();
enemyApplySpy.mockRestore();
});
}
@ -157,7 +160,7 @@ describe.each([
const enemyStartingHp = enemyPokemon.hp;
await game.phaseInterceptor.to("MoveEffectPhase");
expect(playerPokemon.getMoveType).toHaveLastReturnedWith(ty);
expect(tySpy).toHaveLastReturnedWith(ty);
expect(enemyPokemon.hp).toBeLessThan(enemyStartingHp);
}
tySpy.mockRestore();