Skip to content

Commit

Permalink
[Unittest] Prevent Arena Trap/etc from breaking Costar test (pagefaul…
Browse files Browse the repository at this point in the history
  • Loading branch information
DayKev authored Jul 8, 2024
1 parent f932768 commit 458245f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/test/abilities/costar.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,25 @@ describe("Abilities - COSTAR", () => {
game = new GameManager(phaserGame);
vi.spyOn(Overrides, "DOUBLE_BATTLE_OVERRIDE", "get").mockReturnValue(true);
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.COSTAR);
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NASTY_PLOT, Moves.CURSE]);
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NASTY_PLOT]);
vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]);
});


test(
"ability copies positive stat changes",
async () => {
vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH);

await game.startBattle([Species.MAGIKARP, Species.MAGIKARP, Species.FLAMIGO]);

let [leftPokemon, rightPokemon] = game.scene.getPlayerField();
expect(leftPokemon).not.toBe(undefined);
expect(rightPokemon).not.toBe(undefined);
expect(leftPokemon).toBeDefined();
expect(rightPokemon).toBeDefined();

game.doAttack(getMovePosition(game.scene, 0, Moves.NASTY_PLOT));
await game.phaseInterceptor.to(CommandPhase);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
await game.toNextTurn();

expect(leftPokemon.summonData.battleStats[BattleStat.SPATK]).toBe(+2);
Expand All @@ -71,8 +73,8 @@ describe("Abilities - COSTAR", () => {
await game.startBattle([Species.MAGIKARP, Species.MAGIKARP, Species.FLAMIGO]);

let [leftPokemon, rightPokemon] = game.scene.getPlayerField();
expect(leftPokemon).not.toBe(undefined);
expect(rightPokemon).not.toBe(undefined);
expect(leftPokemon).toBeDefined();
expect(rightPokemon).toBeDefined();

expect(leftPokemon.summonData.battleStats[BattleStat.ATK]).toBe(-2);
expect(leftPokemon.summonData.battleStats[BattleStat.ATK]).toBe(-2);
Expand Down

0 comments on commit 458245f

Please sign in to comment.