From 5679aa45dc61d20f87edc142345308b291377f75 Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Wed, 4 Sep 2024 03:10:26 -0700 Subject: [PATCH] Update tests --- src/test/moves/chilly_reception.test.ts | 63 +++++++++++-------------- 1 file changed, 27 insertions(+), 36 deletions(-) diff --git a/src/test/moves/chilly_reception.test.ts b/src/test/moves/chilly_reception.test.ts index b671a3e42c5..ee0ffe392ad 100644 --- a/src/test/moves/chilly_reception.test.ts +++ b/src/test/moves/chilly_reception.test.ts @@ -1,12 +1,11 @@ -import { SPLASH_ONLY } from "../utils/testUtils"; -import { BerryPhase, TurnInitPhase } from "#app/phases"; -import { WeatherType } from "#enums/weather-type"; +import { Abilities } from "#app/enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; +import { WeatherType } from "#enums/weather-type"; +import GameManager from "#test/utils/gameManager"; +import { SPLASH_ONLY } from "#test/utils/testUtils"; import Phaser from "phaser"; -import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; -import GameManager from "../utils/gameManager"; -import { getMovePosition } from "../utils/gameManagerUtils"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; const TIMEOUT = 20 * 1000; @@ -27,43 +26,35 @@ describe("Moves - Chilly Reception", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single") - .moveset([Moves.CHILLY_RECEPTION, Moves.SPLASH, Moves.SNOWSCAPE]) + .moveset([Moves.CHILLY_RECEPTION, Moves.SNOWSCAPE]) .enemyMoveset(SPLASH_ONLY) - .startingLevel(5) - .enemyLevel(5); + .enemyAbility(Abilities.BALL_FETCH) + .ability(Abilities.BALL_FETCH); }); - test( - "Chilly reception should still change the weather if user can't switch out", - async () => { - await game.startBattle([Species.SLOWKING]); + it("should still change the weather if user can't switch out", async () => { + await game.classicMode.startBattle([Species.SLOWKING]); - const enemyPokemon = game.scene.getEnemyPokemon()!; - expect(enemyPokemon).toBeDefined(); - game.doAttack(getMovePosition(game.scene, 0, Moves.CHILLY_RECEPTION)); + game.move.select(Moves.CHILLY_RECEPTION); - await game.phaseInterceptor.to(BerryPhase, false); - expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW); - }, TIMEOUT - ); + await game.phaseInterceptor.to("BerryPhase", false); + expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW); + }, TIMEOUT); - test( - "Chilly reception should switch out even if it's snowing", - async () => { - await game.startBattle([Species.SLOWKING, Species.MEOWTH]); - // first turn set up snow with snowscape, try chilly reception on second turn - game.doAttack(getMovePosition(game.scene, 0, Moves.SNOWSCAPE)); - await game.phaseInterceptor.to(BerryPhase, false); - expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW); + it("should switch out even if it's snowing", async () => { + await game.classicMode.startBattle([Species.SLOWKING, Species.MEOWTH]); + // first turn set up snow with snowscape, try chilly reception on second turn + game.move.select(Moves.SNOWSCAPE); + await game.phaseInterceptor.to("BerryPhase", false); + expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW); - await game.phaseInterceptor.to(TurnInitPhase, false); - game.doAttack(getMovePosition(game.scene, 0, Moves.CHILLY_RECEPTION)); - game.doSelectPartyPokemon(1); + await game.phaseInterceptor.to("TurnInitPhase", false); + game.move.select(Moves.CHILLY_RECEPTION); + game.doSelectPartyPokemon(1); - await game.phaseInterceptor.to(BerryPhase, false); - expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW); - expect(game.scene.getPlayerField()[0].species.speciesId).toBe(Species.MEOWTH); - }, TIMEOUT - ); + await game.phaseInterceptor.to("BerryPhase", false); + expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW); + expect(game.scene.getPlayerField()[0].species.speciesId).toBe(Species.MEOWTH); + }, TIMEOUT); });