Update tests

This commit is contained in:
Dean 2025-03-08 00:12:43 -08:00
parent 6d041e1f6a
commit fbe5465810
2 changed files with 37 additions and 1 deletions

View File

@ -1,5 +1,7 @@
import { PokeballType } from "#app/enums/pokeball";
import { WeatherType } from "#app/enums/weather-type";
import type { CommandPhase } from "#app/phases/command-phase";
import { Command } from "#app/ui/command-ui-handler";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
@ -136,4 +138,20 @@ describe("Abilities - Desolate Land", () => {
expect(game.scene.arena.weather?.weatherType).not.toBe(WeatherType.HARSH_SUN);
});
it("should lift after fleeing from a wild pokemon", async () => {
game.override
.enemyAbility(Abilities.DESOLATE_LAND)
.ability(Abilities.BALL_FETCH);
await game.classicMode.startBattle([ Species.MAGIKARP ]);
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.HARSH_SUN);
vi.spyOn(game.scene.getPlayerPokemon()!, "randSeedInt").mockReturnValue(0);
const commandPhase = game.scene.getCurrentPhase() as CommandPhase;
commandPhase.handleCommand(Command.RUN, 0);
await game.phaseInterceptor.to("BerryPhase");
expect(game.scene.arena.weather?.weatherType).not.toBe(WeatherType.HARSH_SUN);
});
});

View File

@ -1,4 +1,6 @@
import { BattlerIndex } from "#app/battle";
import type { CommandPhase } from "#app/phases/command-phase";
import { Command } from "#app/ui/command-ui-handler";
import { Abilities } from "#enums/abilities";
import { ArenaTagType } from "#enums/arena-tag-type";
import { Moves } from "#enums/moves";
@ -7,7 +9,7 @@ import { Species } from "#enums/species";
import { Stat } from "#enums/stat";
import GameManager from "#test/testUtils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
describe("Abilities - Neutralizing Gas", () => {
let phaserGame: Phaser.Game;
@ -162,4 +164,20 @@ describe("Abilities - Neutralizing Gas", () => {
expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeUndefined();
});
it("should deactivate after fleeing from a wild pokemon", async () => {
game.override
.enemyAbility(Abilities.NEUTRALIZING_GAS)
.ability(Abilities.BALL_FETCH);
await game.classicMode.startBattle([ Species.MAGIKARP ]);
expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeDefined();
vi.spyOn(game.scene.getPlayerPokemon()!, "randSeedInt").mockReturnValue(0);
const commandPhase = game.scene.getCurrentPhase() as CommandPhase;
commandPhase.handleCommand(Command.RUN, 0);
await game.phaseInterceptor.to("BerryPhase");
expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeUndefined();
});
});