[Tests][Mystery-Encounter] Fix The Strong Stuff flakyness (#4394)

* extend: log in encounter phase for better debugging

* 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

* remove accidental it.each

tests were being executed 30-100 times. This is a debugging tool but was never supposed to make it to merge.
This commit is contained in:
flx-sta 2024-09-23 12:32:07 -07:00 committed by GitHub
parent 3ef692227d
commit c4f81c55b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 12 additions and 8 deletions

View File

@ -339,7 +339,7 @@ export async function initBattleWithEnemyConfig(scene: BattleScene, partyConfig:
loadEnemyAssets.push(enemyPokemon.loadAssets());
console.log(enemyPokemon.name, enemyPokemon.species.speciesId, enemyPokemon.stats);
console.log(`Pokemon: ${enemyPokemon.name}`, `Species ID: ${enemyPokemon.species.speciesId}`, `Stats: ${enemyPokemon.stats}`, `Ability: ${enemyPokemon.getAbility().name}`, `Passive Ability: ${enemyPokemon.getPassiveAbility().name}`);
});
scene.pushPhase(new MysteryEncounterBattlePhase(scene, partyConfig.disableSwitch));

View File

@ -141,7 +141,7 @@ export class EncounterPhase extends BattlePhase {
loadEnemyAssets.push(enemyPokemon.loadAssets());
console.log(getPokemonNameWithAffix(enemyPokemon), enemyPokemon.species.speciesId, enemyPokemon.stats);
console.log(`Pokemon: ${getPokemonNameWithAffix(enemyPokemon)}`, `Species ID: ${enemyPokemon.species.speciesId}`, `Stats: ${enemyPokemon.stats}`, `Ability: ${enemyPokemon.getAbility().name}`, `Passive Ability: ${enemyPokemon.getPassiveAbility().name}`);
return true;
});

View File

@ -231,7 +231,7 @@ describe("An Offer You Can't Refuse - Mystery Encounter", () => {
});
describe("Option 3 - Leave", () => {
it.each(Array.from({length: 30}))("should leave encounter without battle", async () => {
it("should leave encounter without battle", async () => {
const leaveEncounterWithoutBattleSpy = vi.spyOn(EncounterPhaseUtils, "leaveEncounterWithoutBattle");
await game.runToMysteryEncounter(MysteryEncounterType.AN_OFFER_YOU_CANT_REFUSE, defaultParty);

View File

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

View File

@ -35,7 +35,7 @@ describe("Reload", () => {
expect(preReloadRngState).toBe(postReloadRngState);
}, 20000);
it.each(Array.from({length: 100}))("should not have RNG inconsistencies after a biome switch", async () => {
it("should not have RNG inconsistencies after a biome switch", async () => {
game.override
.startingWave(10)
.battleType("single")