mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-20 16:42:45 +02:00
Fix some tests to mock proper methods
This commit is contained in:
parent
8ff68e894a
commit
03afffb07f
@ -95,7 +95,7 @@ describe("Abilities - Harvest", () => {
|
||||
|
||||
// Give ourselves harvest and disable enemy neut gas,
|
||||
// but force our roll to fail so we don't accidentally recover anything
|
||||
vi.spyOn(PostTurnRestoreBerryAbAttr.prototype, "canApplyPostTurn").mockReturnValueOnce(false);
|
||||
vi.spyOn(PostTurnRestoreBerryAbAttr.prototype, "canApply").mockReturnValueOnce(false);
|
||||
game.override.ability(AbilityId.HARVEST);
|
||||
game.move.select(MoveId.GASTRO_ACID);
|
||||
await game.move.selectEnemyMove(MoveId.NUZZLE);
|
||||
|
@ -42,7 +42,7 @@ describe("Abilities - Healer", () => {
|
||||
});
|
||||
|
||||
it("should not queue a message phase for healing if the ally has fainted", async () => {
|
||||
const abSpy = vi.spyOn(PostTurnResetStatusAbAttr.prototype, "canApplyPostTurn");
|
||||
const abSpy = vi.spyOn(PostTurnResetStatusAbAttr.prototype, "canApply");
|
||||
game.override.moveset([MoveId.SPLASH, MoveId.LUNAR_DANCE]);
|
||||
await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MAGIKARP]);
|
||||
|
||||
|
@ -68,7 +68,7 @@ describe("Abilities - Moody", () => {
|
||||
});
|
||||
|
||||
it("should only decrease one stat stage by 1 stage if all stat stages are at 6", async () => {
|
||||
await game.classicMode.startBattle();
|
||||
await game.classicMode.startBattle([SpeciesId.MAGIKARP]);
|
||||
|
||||
const playerPokemon = game.scene.getPlayerPokemon()!;
|
||||
|
||||
|
@ -178,7 +178,7 @@ describe("Abilities - Neutralizing Gas", () => {
|
||||
|
||||
const enemy = game.scene.getEnemyPokemon()!;
|
||||
const weatherChangeAttr = enemy.getAbilityAttrs("PostSummonWeatherChangeAbAttr", false)[0];
|
||||
vi.spyOn(weatherChangeAttr, "applyPostSummon");
|
||||
const weatherChangeSpy = vi.spyOn(weatherChangeAttr, "apply");
|
||||
|
||||
expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeDefined();
|
||||
|
||||
@ -187,6 +187,6 @@ describe("Abilities - Neutralizing Gas", () => {
|
||||
await game.killPokemon(game.scene.getPlayerPokemon()!);
|
||||
|
||||
expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeUndefined();
|
||||
expect(weatherChangeAttr.applyPostSummon).not.toHaveBeenCalled();
|
||||
expect(weatherChangeSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
@ -1,3 +1,4 @@
|
||||
import type { StatMultiplierAbAttrParams } from "#app/@types/ability-types";
|
||||
import { allAbilities } from "#app/data/data-lists";
|
||||
import { CommandPhase } from "#app/phases/command-phase";
|
||||
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
|
||||
@ -46,15 +47,13 @@ describe("Abilities - Sand Veil", () => {
|
||||
vi.spyOn(leadPokemon[0], "getAbility").mockReturnValue(allAbilities[AbilityId.SAND_VEIL]);
|
||||
|
||||
const sandVeilAttr = allAbilities[AbilityId.SAND_VEIL].getAttrs("StatMultiplierAbAttr")[0];
|
||||
vi.spyOn(sandVeilAttr, "applyStatStage").mockImplementation(
|
||||
(_pokemon, _passive, _simulated, stat, statValue, _args) => {
|
||||
if (stat === Stat.EVA && game.scene.arena.weather?.weatherType === WeatherType.SANDSTORM) {
|
||||
statValue.value *= -1; // will make all attacks miss
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
);
|
||||
vi.spyOn(sandVeilAttr, "apply").mockImplementation(({ stat, statVal }: StatMultiplierAbAttrParams) => {
|
||||
if (stat === Stat.EVA && game.scene.arena.weather?.weatherType === WeatherType.SANDSTORM) {
|
||||
statVal.value *= -1; // will make all attacks miss
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
expect(leadPokemon[0].hasAbility(AbilityId.SAND_VEIL)).toBe(true);
|
||||
expect(leadPokemon[1].hasAbility(AbilityId.SAND_VEIL)).toBe(false);
|
||||
|
@ -277,7 +277,7 @@ describe("Abilities - Unburden", () => {
|
||||
const initialTreeckoSpeed = treecko.getStat(Stat.SPD);
|
||||
const initialPurrloinSpeed = purrloin.getStat(Stat.SPD);
|
||||
const unburdenAttr = treecko.getAbilityAttrs("PostItemLostAbAttr")[0];
|
||||
vi.spyOn(unburdenAttr, "applyPostItemLost");
|
||||
vi.spyOn(unburdenAttr, "apply");
|
||||
|
||||
// Player uses Baton Pass, which also passes the Baton item
|
||||
game.move.select(MoveId.BATON_PASS);
|
||||
|
Loading…
Reference in New Issue
Block a user