[Test] Fix several flaky tests (#4639)
This commit is contained in:
parent
cfb92b4e08
commit
b7eb95b761
|
@ -33,7 +33,7 @@ describe("Moves - Safeguard", () => {
|
||||||
.enemyLevel(5)
|
.enemyLevel(5)
|
||||||
.starterSpecies(Species.DRATINI)
|
.starterSpecies(Species.DRATINI)
|
||||||
.moveset([ Moves.NUZZLE, Moves.SPORE, Moves.YAWN, Moves.SPLASH ])
|
.moveset([ Moves.NUZZLE, Moves.SPORE, Moves.YAWN, Moves.SPLASH ])
|
||||||
.ability(Abilities.BALL_FETCH);
|
.ability(Abilities.UNNERVE); // Stop wild Pokemon from potentially eating Lum Berry
|
||||||
});
|
});
|
||||||
|
|
||||||
it("protects from damaging moves with additional effects", async () => {
|
it("protects from damaging moves with additional effects", async () => {
|
||||||
|
|
|
@ -18,6 +18,7 @@ import { Moves } from "#enums/moves";
|
||||||
import { ShinyRateBoosterModifier } from "#app/modifier/modifier";
|
import { ShinyRateBoosterModifier } from "#app/modifier/modifier";
|
||||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
import { Abilities } from "#enums/abilities";
|
||||||
|
|
||||||
const namespace = "mysteryEncounters/anOfferYouCantRefuse";
|
const namespace = "mysteryEncounters/anOfferYouCantRefuse";
|
||||||
/** Gyarados for Indimidate */
|
/** Gyarados for Indimidate */
|
||||||
|
@ -37,10 +38,11 @@ describe("An Offer You Can't Refuse - 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.mysteryEncounterChance(100)
|
||||||
game.override.startingWave(defaultWave);
|
.startingWave(defaultWave)
|
||||||
game.override.startingBiome(defaultBiome);
|
.startingBiome(defaultBiome)
|
||||||
game.override.disableTrainerWaves();
|
.disableTrainerWaves()
|
||||||
|
.ability(Abilities.INTIMIDATE); // Extortion ability
|
||||||
|
|
||||||
const biomeMap = new Map<Biome, MysteryEncounterType[]>([
|
const biomeMap = new Map<Biome, MysteryEncounterType[]>([
|
||||||
[ Biome.VOLCANO, [ MysteryEncounterType.MYSTERIOUS_CHALLENGERS ]],
|
[ Biome.VOLCANO, [ MysteryEncounterType.MYSTERIOUS_CHALLENGERS ]],
|
||||||
|
@ -195,6 +197,7 @@ describe("An Offer You Can't Refuse - Mystery Encounter", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should award EXP to a pokemon with a move in EXTORTION_MOVES", async () => {
|
it("should award EXP to a pokemon with a move in EXTORTION_MOVES", async () => {
|
||||||
|
game.override.ability(Abilities.SYNCHRONIZE); // Not an extortion ability, so we can test extortion move
|
||||||
await game.runToMysteryEncounter(MysteryEncounterType.AN_OFFER_YOU_CANT_REFUSE, [ Species.ABRA ]);
|
await game.runToMysteryEncounter(MysteryEncounterType.AN_OFFER_YOU_CANT_REFUSE, [ Species.ABRA ]);
|
||||||
const party = scene.getParty();
|
const party = scene.getParty();
|
||||||
const abra = party.find((pkm) => pkm.species.speciesId === Species.ABRA)!;
|
const abra = party.find((pkm) => pkm.species.speciesId === Species.ABRA)!;
|
||||||
|
|
|
@ -176,10 +176,12 @@ describe("Berries Abound - Mystery Encounter", () => {
|
||||||
const encounterTextSpy = vi.spyOn(EncounterDialogueUtils, "showEncounterText");
|
const encounterTextSpy = vi.spyOn(EncounterDialogueUtils, "showEncounterText");
|
||||||
await game.runToMysteryEncounter(MysteryEncounterType.BERRIES_ABOUND, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.BERRIES_ABOUND, defaultParty);
|
||||||
|
|
||||||
|
scene.getParty().forEach(pkm => {
|
||||||
|
vi.spyOn(pkm, "getStat").mockReturnValue(1); // for ease return for every stat
|
||||||
|
});
|
||||||
|
|
||||||
const config = game.scene.currentBattle.mysteryEncounter!.enemyPartyConfigs[0];
|
const config = game.scene.currentBattle.mysteryEncounter!.enemyPartyConfigs[0];
|
||||||
const speciesToSpawn = config.pokemonConfigs?.[0].species.speciesId;
|
const speciesToSpawn = config.pokemonConfigs?.[0].species.speciesId;
|
||||||
// Setting enemy's level arbitrarily high to outspeed
|
|
||||||
config.pokemonConfigs![0].dataSource!.level = 1000;
|
|
||||||
|
|
||||||
await runMysteryEncounterToEnd(game, 2, undefined, true);
|
await runMysteryEncounterToEnd(game, 2, undefined, true);
|
||||||
|
|
||||||
|
@ -198,10 +200,12 @@ describe("Berries Abound - Mystery Encounter", () => {
|
||||||
const encounterTextSpy = vi.spyOn(EncounterDialogueUtils, "showEncounterText");
|
const encounterTextSpy = vi.spyOn(EncounterDialogueUtils, "showEncounterText");
|
||||||
await game.runToMysteryEncounter(MysteryEncounterType.BERRIES_ABOUND, defaultParty);
|
await game.runToMysteryEncounter(MysteryEncounterType.BERRIES_ABOUND, defaultParty);
|
||||||
|
|
||||||
|
scene.getParty().forEach(pkm => {
|
||||||
|
vi.spyOn(pkm, "getStat").mockReturnValue(1); // for ease return for every stat
|
||||||
|
});
|
||||||
|
|
||||||
const config = game.scene.currentBattle.mysteryEncounter!.enemyPartyConfigs[0];
|
const config = game.scene.currentBattle.mysteryEncounter!.enemyPartyConfigs[0];
|
||||||
const speciesToSpawn = config.pokemonConfigs?.[0].species.speciesId;
|
const speciesToSpawn = config.pokemonConfigs?.[0].species.speciesId;
|
||||||
// Setting enemy's level arbitrarily high to outspeed
|
|
||||||
config.pokemonConfigs![0].dataSource!.level = 1000;
|
|
||||||
|
|
||||||
await runMysteryEncounterToEnd(game, 2, undefined, true);
|
await runMysteryEncounterToEnd(game, 2, undefined, true);
|
||||||
|
|
||||||
|
|
|
@ -147,8 +147,8 @@ describe("The Pokemon Salesman - Mystery Encounter", () => {
|
||||||
|
|
||||||
expect(scene.getParty().length).toBe(initialPartySize + 1);
|
expect(scene.getParty().length).toBe(initialPartySize + 1);
|
||||||
|
|
||||||
const newlyPurchasedPokemon = scene.getParty().find(p => p.name === pokemonName);
|
const newlyPurchasedPokemon = scene.getParty()[scene.getParty().length - 1];
|
||||||
expect(newlyPurchasedPokemon).toBeDefined();
|
expect(newlyPurchasedPokemon.name).toBe(pokemonName);
|
||||||
expect(newlyPurchasedPokemon!.moveset.length > 0).toBeTruthy();
|
expect(newlyPurchasedPokemon!.moveset.length > 0).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue