From c9cda53724f990cffac7b1f0c49fe91dd93c5d9a Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Sun, 25 Aug 2024 11:35:57 -0700 Subject: [PATCH] Add regression test --- src/test/abilities/delta_stream.test.ts | 50 +++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/test/abilities/delta_stream.test.ts diff --git a/src/test/abilities/delta_stream.test.ts b/src/test/abilities/delta_stream.test.ts new file mode 100644 index 00000000000..0482d7f7b37 --- /dev/null +++ b/src/test/abilities/delta_stream.test.ts @@ -0,0 +1,50 @@ +import { Moves } from "#app/enums/moves"; +import { Species } from "#app/enums/species"; +import { WeatherType } from "#app/enums/weather-type"; +import { Abilities } from "#enums/abilities"; +import GameManager from "#test/utils/gameManager"; +import { SPLASH_ONLY } from "#test/utils/testUtils"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; + +describe("Abilities - Delta Stream", () => { + let phaserGame: Phaser.Game; + let game: GameManager; + + beforeAll(() => { + phaserGame = new Phaser.Game({ + type: Phaser.HEADLESS, + }); + }); + + afterEach(() => { + game.phaseInterceptor.restoreOg(); + }); + + beforeEach(() => { + game = new GameManager(phaserGame); + game.override + .battleType("double") + .enemyAbility(Abilities.BALL_FETCH) + .enemyMoveset(SPLASH_ONLY) + .enemySpecies(Species.MAGIKARP) + .moveset([Moves.SPLASH]) + .starterForms({ + [Species.RAYQUAZA]: 1 + }); + }); + + it("no longer applies after transition from double to single battle", async () => { + await game.startBattle([Species.FEEBAS, Species.RAYQUAZA]); + + expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.STRONG_WINDS); + + game.move.select(Moves.SPLASH); + game.move.select(Moves.SPLASH, 1); + await game.doKillOpponents(); + game.override.battleType("single"); + await game.toNextWave(); + + expect(game.scene.arena.weather?.weatherType).toBeUndefined(); + }); +});