fix: the storng stuff test flakiness

The enemy pokemon could get contrary or other abilities that cause the expected values to be ... not as expected
This commit is contained in:
flx-sta 2024-09-23 12:07:09 -07:00
parent 5696352f1f
commit 354fe452ad

View File

@ -25,6 +25,7 @@ import { MysteryEncounterPokemonData } from "#app/data/mystery-encounters/myster
import { CommandPhase } from "#app/phases/command-phase"; import { CommandPhase } from "#app/phases/command-phase";
import { MovePhase } from "#app/phases/move-phase"; import { MovePhase } from "#app/phases/move-phase";
import { SelectModifierPhase } from "#app/phases/select-modifier-phase"; import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
import { Abilities } from "#app/enums/abilities";
const namespace = "mysteryEncounter:theStrongStuff"; const namespace = "mysteryEncounter:theStrongStuff";
const defaultParty = [Species.LAPRAS, Species.GENGAR, Species.ABRA]; const defaultParty = [Species.LAPRAS, Species.GENGAR, Species.ABRA];
@ -43,10 +44,13 @@ describe("The Strong Stuff - Mystery Encounter", () => {
beforeEach(async () => { beforeEach(async () => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
scene = game.scene; scene = game.scene;
game.override.mysteryEncounterChance(100); game.override
game.override.startingWave(defaultWave); .mysteryEncounterChance(100)
game.override.startingBiome(defaultBiome); .startingWave(defaultWave)
game.override.disableTrainerWaves(); .startingBiome(defaultBiome)
.disableTrainerWaves()
.enemyAbility(Abilities.BALL_FETCH)
.enemyPassiveAbility(Abilities.BALL_FETCH);
vi.spyOn(MysteryEncounters, "mysteryEncountersByBiome", "get").mockReturnValue( vi.spyOn(MysteryEncounters, "mysteryEncountersByBiome", "get").mockReturnValue(
new Map<Biome, MysteryEncounterType[]>([ new Map<Biome, MysteryEncounterType[]>([
@ -180,7 +184,7 @@ describe("The Strong Stuff - Mystery Encounter", () => {
}); });
}); });
it("should start battle against Shuckle", async () => { it.each(Array.from({length: 50}))("should start battle against Shuckle", async () => {
const phaseSpy = vi.spyOn(scene, "pushPhase"); const phaseSpy = vi.spyOn(scene, "pushPhase");
await game.runToMysteryEncounter(MysteryEncounterType.THE_STRONG_STUFF, defaultParty); await game.runToMysteryEncounter(MysteryEncounterType.THE_STRONG_STUFF, defaultParty);