From 2bc5f501545d83690e25fe524d2e01698ec216ac Mon Sep 17 00:00:00 2001 From: PigeonBar <56974298+PigeonBar@users.noreply.github.com> Date: Fri, 4 Oct 2024 10:42:20 -0400 Subject: [PATCH] [Test] Fix some test flakiness involving `doKillOpponents()` (#4571) * [Test] Fix some test flakiness involving game.doKillOpponents() * PR Feedback * Fix linting --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --- src/test/daily_mode.test.ts | 14 ++++++-------- src/test/reload.test.ts | 12 ++++-------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/test/daily_mode.test.ts b/src/test/daily_mode.test.ts index f832d17cc6c..100cf07f9c0 100644 --- a/src/test/daily_mode.test.ts +++ b/src/test/daily_mode.test.ts @@ -5,6 +5,7 @@ import { Moves } from "#app/enums/moves"; import { Biome } from "#app/enums/biome"; import { Mode } from "#app/ui/ui"; import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler"; +import { Species } from "#enums/species"; //const TIMEOUT = 20 * 1000; @@ -53,12 +54,11 @@ describe("Shop modifications", async () => { game.override .startingWave(9) - .startingBiome(Biome.ICE_CAVE) // Will lead to Snowy Forest with randomly generated weather + .startingBiome(Biome.ICE_CAVE) .battleType("single") .startingLevel(100) // Avoid levelling up - .enemyLevel(1000) // Avoid opponent dying before game.doKillOpponents() .disableTrainerWaves() - .moveset([ Moves.KOWTOW_CLEAVE ]) + .moveset([ Moves.SPLASH ]) .enemyMoveset(Moves.SPLASH); game.modifiers .addCheck("EVIOLITE") @@ -71,9 +71,8 @@ describe("Shop modifications", async () => { }); it("should not have Eviolite and Mini Black Hole available in Classic if not unlocked", async () => { - await game.classicMode.startBattle(); - game.move.select(Moves.KOWTOW_CLEAVE); - await game.phaseInterceptor.to("DamagePhase"); + await game.classicMode.startBattle([ Species.BULBASAUR ]); + game.move.select(Moves.SPLASH); await game.doKillOpponents(); await game.phaseInterceptor.to("BattleEndPhase"); game.onNextPrompt("SelectModifierPhase", Mode.MODIFIER_SELECT, () => { @@ -86,8 +85,7 @@ describe("Shop modifications", async () => { it("should have Eviolite and Mini Black Hole available in Daily", async () => { await game.dailyMode.startBattle(); - game.move.select(Moves.KOWTOW_CLEAVE); - await game.phaseInterceptor.to("DamagePhase"); + game.move.select(Moves.SPLASH); await game.doKillOpponents(); await game.phaseInterceptor.to("BattleEndPhase"); game.onNextPrompt("SelectModifierPhase", Mode.MODIFIER_SELECT, () => { diff --git a/src/test/reload.test.ts b/src/test/reload.test.ts index 7849f8f0080..b15e9691ed6 100644 --- a/src/test/reload.test.ts +++ b/src/test/reload.test.ts @@ -44,15 +44,13 @@ describe("Reload", () => { .startingWave(10) .battleType("single") .startingLevel(100) // Avoid levelling up - .enemyLevel(1000) // Avoid opponent dying before game.doKillOpponents() .disableTrainerWaves() - .moveset([ Moves.KOWTOW_CLEAVE ]) + .moveset([ Moves.SPLASH ]) .enemyMoveset(Moves.SPLASH); await game.dailyMode.startBattle(); // Transition from Wave 10 to Wave 11 in order to trigger biome switch - game.move.select(Moves.KOWTOW_CLEAVE); - await game.phaseInterceptor.to("DamagePhase"); + game.move.select(Moves.SPLASH); await game.doKillOpponents(); game.onNextPrompt("SelectBiomePhase", Mode.OPTION_SELECT, () => { (game.scene.time as MockClock).overrideDelay = null; @@ -79,15 +77,13 @@ describe("Reload", () => { .startingBiome(Biome.ICE_CAVE) // Will lead to Snowy Forest with randomly generated weather .battleType("single") .startingLevel(100) // Avoid levelling up - .enemyLevel(1000) // Avoid opponent dying before game.doKillOpponents() .disableTrainerWaves() - .moveset([ Moves.KOWTOW_CLEAVE ]) + .moveset([ Moves.SPLASH ]) .enemyMoveset(Moves.SPLASH); await game.classicMode.startBattle(); // Apparently daily mode would override the biome // Transition from Wave 10 to Wave 11 in order to trigger biome switch - game.move.select(Moves.KOWTOW_CLEAVE); - await game.phaseInterceptor.to("DamagePhase"); + game.move.select(Moves.SPLASH); await game.doKillOpponents(); await game.toNextWave(); expect(game.phaseInterceptor.log).toContain("NewBiomeEncounterPhase");