mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-29 02:39:28 +02:00
fix: shell side arm test flakyness
some rng could affect the tests thus it wasn't guaranteed to be consistent in its result. Fixed that by taking control of `getBaseDamage()` with a spy
This commit is contained in:
parent
107a7497a9
commit
45e3c6bf87
@ -1,5 +1,5 @@
|
|||||||
import { BattlerIndex } from "#app/battle";
|
import { BattlerIndex } from "#app/battle";
|
||||||
import { allMoves, ShellSideArmCategoryAttr } from "#app/data/move";
|
import { allMoves, MoveCategory, ShellSideArmCategoryAttr } from "#app/data/move";
|
||||||
import { Abilities } from "#enums/abilities";
|
import { Abilities } from "#enums/abilities";
|
||||||
import { Moves } from "#enums/moves";
|
import { Moves } from "#enums/moves";
|
||||||
import { Species } from "#enums/species";
|
import { Species } from "#enums/species";
|
||||||
@ -36,6 +36,15 @@ describe("Moves - Shell Side Arm", () => {
|
|||||||
|
|
||||||
await game.classicMode.startBattle([Species.MANAPHY]);
|
await game.classicMode.startBattle([Species.MANAPHY]);
|
||||||
|
|
||||||
|
const enemySnorlax = game.scene.getEnemyPokemon()!;
|
||||||
|
vi.spyOn(enemySnorlax, "getBaseDamage").mockImplementation((_user, _move, category) => {
|
||||||
|
if (category === MoveCategory.PHYSICAL) {
|
||||||
|
return 100;
|
||||||
|
} else {
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const shellSideArm = allMoves[Moves.SHELL_SIDE_ARM];
|
const shellSideArm = allMoves[Moves.SHELL_SIDE_ARM];
|
||||||
const shellSideArmAttr = shellSideArm.getAttrs(ShellSideArmCategoryAttr)[0];
|
const shellSideArmAttr = shellSideArm.getAttrs(ShellSideArmCategoryAttr)[0];
|
||||||
vi.spyOn(shellSideArmAttr, "apply");
|
vi.spyOn(shellSideArmAttr, "apply");
|
||||||
@ -52,6 +61,15 @@ describe("Moves - Shell Side Arm", () => {
|
|||||||
|
|
||||||
await game.classicMode.startBattle([Species.MANAPHY]);
|
await game.classicMode.startBattle([Species.MANAPHY]);
|
||||||
|
|
||||||
|
const enemySlowbro = game.scene.getEnemyPokemon()!;
|
||||||
|
vi.spyOn(enemySlowbro, "getBaseDamage").mockImplementation((_user, _move, category) => {
|
||||||
|
if (category === MoveCategory.SPECIAL) {
|
||||||
|
return 100;
|
||||||
|
} else {
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const shellSideArm = allMoves[Moves.SHELL_SIDE_ARM];
|
const shellSideArm = allMoves[Moves.SHELL_SIDE_ARM];
|
||||||
const shellSideArmAttr = shellSideArm.getAttrs(ShellSideArmCategoryAttr)[0];
|
const shellSideArmAttr = shellSideArm.getAttrs(ShellSideArmCategoryAttr)[0];
|
||||||
vi.spyOn(shellSideArmAttr, "apply");
|
vi.spyOn(shellSideArmAttr, "apply");
|
||||||
|
Loading…
Reference in New Issue
Block a user