mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 00:52:47 +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,
|
// Give ourselves harvest and disable enemy neut gas,
|
||||||
// but force our roll to fail so we don't accidentally recover anything
|
// 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.override.ability(AbilityId.HARVEST);
|
||||||
game.move.select(MoveId.GASTRO_ACID);
|
game.move.select(MoveId.GASTRO_ACID);
|
||||||
await game.move.selectEnemyMove(MoveId.NUZZLE);
|
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 () => {
|
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]);
|
game.override.moveset([MoveId.SPLASH, MoveId.LUNAR_DANCE]);
|
||||||
await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MAGIKARP]);
|
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 () => {
|
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()!;
|
const playerPokemon = game.scene.getPlayerPokemon()!;
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ describe("Abilities - Neutralizing Gas", () => {
|
|||||||
|
|
||||||
const enemy = game.scene.getEnemyPokemon()!;
|
const enemy = game.scene.getEnemyPokemon()!;
|
||||||
const weatherChangeAttr = enemy.getAbilityAttrs("PostSummonWeatherChangeAbAttr", false)[0];
|
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();
|
expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeDefined();
|
||||||
|
|
||||||
@ -187,6 +187,6 @@ describe("Abilities - Neutralizing Gas", () => {
|
|||||||
await game.killPokemon(game.scene.getPlayerPokemon()!);
|
await game.killPokemon(game.scene.getPlayerPokemon()!);
|
||||||
|
|
||||||
expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeUndefined();
|
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 { allAbilities } from "#app/data/data-lists";
|
||||||
import { CommandPhase } from "#app/phases/command-phase";
|
import { CommandPhase } from "#app/phases/command-phase";
|
||||||
import { MoveEffectPhase } from "#app/phases/move-effect-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]);
|
vi.spyOn(leadPokemon[0], "getAbility").mockReturnValue(allAbilities[AbilityId.SAND_VEIL]);
|
||||||
|
|
||||||
const sandVeilAttr = allAbilities[AbilityId.SAND_VEIL].getAttrs("StatMultiplierAbAttr")[0];
|
const sandVeilAttr = allAbilities[AbilityId.SAND_VEIL].getAttrs("StatMultiplierAbAttr")[0];
|
||||||
vi.spyOn(sandVeilAttr, "applyStatStage").mockImplementation(
|
vi.spyOn(sandVeilAttr, "apply").mockImplementation(({ stat, statVal }: StatMultiplierAbAttrParams) => {
|
||||||
(_pokemon, _passive, _simulated, stat, statValue, _args) => {
|
if (stat === Stat.EVA && game.scene.arena.weather?.weatherType === WeatherType.SANDSTORM) {
|
||||||
if (stat === Stat.EVA && game.scene.arena.weather?.weatherType === WeatherType.SANDSTORM) {
|
statVal.value *= -1; // will make all attacks miss
|
||||||
statValue.value *= -1; // will make all attacks miss
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
return false;
|
||||||
return false;
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(leadPokemon[0].hasAbility(AbilityId.SAND_VEIL)).toBe(true);
|
expect(leadPokemon[0].hasAbility(AbilityId.SAND_VEIL)).toBe(true);
|
||||||
expect(leadPokemon[1].hasAbility(AbilityId.SAND_VEIL)).toBe(false);
|
expect(leadPokemon[1].hasAbility(AbilityId.SAND_VEIL)).toBe(false);
|
||||||
|
@ -277,7 +277,7 @@ describe("Abilities - Unburden", () => {
|
|||||||
const initialTreeckoSpeed = treecko.getStat(Stat.SPD);
|
const initialTreeckoSpeed = treecko.getStat(Stat.SPD);
|
||||||
const initialPurrloinSpeed = purrloin.getStat(Stat.SPD);
|
const initialPurrloinSpeed = purrloin.getStat(Stat.SPD);
|
||||||
const unburdenAttr = treecko.getAbilityAttrs("PostItemLostAbAttr")[0];
|
const unburdenAttr = treecko.getAbilityAttrs("PostItemLostAbAttr")[0];
|
||||||
vi.spyOn(unburdenAttr, "applyPostItemLost");
|
vi.spyOn(unburdenAttr, "apply");
|
||||||
|
|
||||||
// Player uses Baton Pass, which also passes the Baton item
|
// Player uses Baton Pass, which also passes the Baton item
|
||||||
game.move.select(MoveId.BATON_PASS);
|
game.move.select(MoveId.BATON_PASS);
|
||||||
|
Loading…
Reference in New Issue
Block a user