mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-25 16:26:25 +00:00
[Test] Fix flaky Shell Side Arm test (#4383)
Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com>
This commit is contained in:
parent
8b6e55d5e9
commit
1d559f2194
@ -5,11 +5,14 @@ import { Moves } from "#enums/moves";
|
|||||||
import { Species } from "#enums/species";
|
import { Species } from "#enums/species";
|
||||||
import GameManager from "#test/utils/gameManager";
|
import GameManager from "#test/utils/gameManager";
|
||||||
import Phaser from "phaser";
|
import Phaser from "phaser";
|
||||||
import { afterEach, beforeAll, beforeEach, describe, it, expect, vi } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
|
|
||||||
describe("Moves - Shell Side Arm", () => {
|
describe("Moves - Shell Side Arm", () => {
|
||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
let game: GameManager;
|
let game: GameManager;
|
||||||
|
const shellSideArm = allMoves[Moves.SHELL_SIDE_ARM];
|
||||||
|
const shellSideArmAttr = shellSideArm.getAttrs(ShellSideArmCategoryAttr)[0];
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
phaserGame = new Phaser.Game({
|
phaserGame = new Phaser.Game({
|
||||||
type: Phaser.HEADLESS,
|
type: Phaser.HEADLESS,
|
||||||
@ -34,14 +37,11 @@ describe("Moves - Shell Side Arm", () => {
|
|||||||
it("becomes a physical attack if forecasted to deal more damage as physical", async () => {
|
it("becomes a physical attack if forecasted to deal more damage as physical", async () => {
|
||||||
game.override.enemySpecies(Species.SNORLAX);
|
game.override.enemySpecies(Species.SNORLAX);
|
||||||
|
|
||||||
await game.classicMode.startBattle([Species.MANAPHY]);
|
await game.classicMode.startBattle([Species.RAMPARDOS]);
|
||||||
|
|
||||||
const shellSideArm = allMoves[Moves.SHELL_SIDE_ARM];
|
|
||||||
const shellSideArmAttr = shellSideArm.getAttrs(ShellSideArmCategoryAttr)[0];
|
|
||||||
vi.spyOn(shellSideArmAttr, "apply");
|
vi.spyOn(shellSideArmAttr, "apply");
|
||||||
|
|
||||||
game.move.select(Moves.SHELL_SIDE_ARM);
|
game.move.select(Moves.SHELL_SIDE_ARM);
|
||||||
|
|
||||||
await game.phaseInterceptor.to("MoveEffectPhase");
|
await game.phaseInterceptor.to("MoveEffectPhase");
|
||||||
|
|
||||||
expect(shellSideArmAttr.apply).toHaveLastReturnedWith(true);
|
expect(shellSideArmAttr.apply).toHaveLastReturnedWith(true);
|
||||||
@ -50,14 +50,11 @@ describe("Moves - Shell Side Arm", () => {
|
|||||||
it("remains a special attack if forecasted to deal more damage as special", async () => {
|
it("remains a special attack if forecasted to deal more damage as special", async () => {
|
||||||
game.override.enemySpecies(Species.SLOWBRO);
|
game.override.enemySpecies(Species.SLOWBRO);
|
||||||
|
|
||||||
await game.classicMode.startBattle([Species.MANAPHY]);
|
await game.classicMode.startBattle([Species.XURKITREE]);
|
||||||
|
|
||||||
const shellSideArm = allMoves[Moves.SHELL_SIDE_ARM];
|
|
||||||
const shellSideArmAttr = shellSideArm.getAttrs(ShellSideArmCategoryAttr)[0];
|
|
||||||
vi.spyOn(shellSideArmAttr, "apply");
|
vi.spyOn(shellSideArmAttr, "apply");
|
||||||
|
|
||||||
game.move.select(Moves.SHELL_SIDE_ARM);
|
game.move.select(Moves.SHELL_SIDE_ARM);
|
||||||
|
|
||||||
await game.phaseInterceptor.to("MoveEffectPhase");
|
await game.phaseInterceptor.to("MoveEffectPhase");
|
||||||
|
|
||||||
expect(shellSideArmAttr.apply).toHaveLastReturnedWith(false);
|
expect(shellSideArmAttr.apply).toHaveLastReturnedWith(false);
|
||||||
@ -70,14 +67,10 @@ describe("Moves - Shell Side Arm", () => {
|
|||||||
|
|
||||||
await game.classicMode.startBattle([Species.MANAPHY]);
|
await game.classicMode.startBattle([Species.MANAPHY]);
|
||||||
|
|
||||||
const shellSideArm = allMoves[Moves.SHELL_SIDE_ARM];
|
|
||||||
const shellSideArmAttr = shellSideArm.getAttrs(ShellSideArmCategoryAttr)[0];
|
|
||||||
vi.spyOn(shellSideArmAttr, "apply");
|
vi.spyOn(shellSideArmAttr, "apply");
|
||||||
|
|
||||||
game.move.select(Moves.SHELL_SIDE_ARM);
|
game.move.select(Moves.SHELL_SIDE_ARM);
|
||||||
|
|
||||||
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
||||||
|
|
||||||
await game.phaseInterceptor.to("BerryPhase", false);
|
await game.phaseInterceptor.to("BerryPhase", false);
|
||||||
|
|
||||||
expect(shellSideArmAttr.apply).toHaveLastReturnedWith(false);
|
expect(shellSideArmAttr.apply).toHaveLastReturnedWith(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user