fix: berries abound tests

the "Should skip battle when fastest pokemon is faster than boss" test was failing due to the party being more than 1 pokemon.
This commit is contained in:
flx-sta 2024-09-20 08:29:54 -07:00
parent bb8cad9eff
commit 6f0d3b1681

View File

@ -190,15 +190,14 @@ describe("Berries Abound - Mystery Encounter", () => {
});
it("Should skip battle when fastest pokemon is faster than boss", async () => {
const leaveEncounterWithoutBattleSpy = vi.spyOn(EncounterPhaseUtils, "leaveEncounterWithoutBattle");
const encounterTextSpy = vi.spyOn(EncounterDialogueUtils, "showEncounterText");
vi.spyOn(EncounterPhaseUtils, "leaveEncounterWithoutBattle");
vi.spyOn(EncounterDialogueUtils, "showEncounterText");
await game.runToMysteryEncounter(MysteryEncounterType.BERRIES_ABOUND, defaultParty);
// Setting party pokemon's level arbitrarily high to outspeed
const fastestPokemon = scene.getParty()[0];
fastestPokemon.level = 1000;
fastestPokemon.calculateStats();
scene.getParty().forEach(pkm => {
vi.spyOn(pkm, "getStat").mockReturnValue(9999); // for ease return for every stat
});
await runMysteryEncounterToEnd(game, 2);
await game.phaseInterceptor.to(SelectModifierPhase, false);
@ -212,8 +211,8 @@ describe("Berries Abound - Mystery Encounter", () => {
expect(option.modifierTypeOption.type.id).toContain("BERRY");
}
expect(encounterTextSpy).toHaveBeenCalledWith(expect.any(BattleScene), `${namespace}.option.2.selected`);
expect(leaveEncounterWithoutBattleSpy).toBeCalled();
expect(EncounterDialogueUtils.showEncounterText).toHaveBeenCalledWith(expect.any(BattleScene), `${namespace}.option.2.selected`);
expect(EncounterPhaseUtils.leaveEncounterWithoutBattle).toBeCalled();
});
});