[Test] Remove unneeded mockRestore and testTimeout calls in tests

https://github.com/pagefaultgames/pokerogue/pull/5927/

* Removed unnecessary test timeout parameters from test files

We set it in vitest config anyways

* Removed unneeded `mockRestore` calls

We call `restoreAllMocks` after each test runs anyhow

* Removed accidentall forgotten-about timeout

* Revdrt magic bounce test file for now

* Fixed ting

* Fixed bug

* Fixed import

* Update test/data/status_effect.test.ts

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* Update battle.test.ts

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* Ran bim

---------

Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
This commit is contained in:
Bertie690 2025-06-15 03:48:16 -04:00 committed by GitHub
parent 061c987265
commit 0918985a63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
85 changed files with 207 additions and 287 deletions

View File

@ -50,5 +50,5 @@ describe("Ability Timing", () => {
await game.phaseInterceptor.to("MessagePhase"); await game.phaseInterceptor.to("MessagePhase");
expect(i18next.t).toHaveBeenCalledWith("battle:statFell", expect.objectContaining({ count: 1 })); expect(i18next.t).toHaveBeenCalledWith("battle:statFell", expect.objectContaining({ count: 1 }));
}, 5000); });
}); });

View File

@ -47,7 +47,7 @@ describe("Abilities - Beast Boost", () => {
await game.phaseInterceptor.to("VictoryPhase"); await game.phaseInterceptor.to("VictoryPhase");
expect(playerPokemon.getStatStage(Stat.DEF)).toBe(1); expect(playerPokemon.getStatStage(Stat.DEF)).toBe(1);
}, 20000); });
it("should use in-battle overriden stats when determining the stat stage to raise by 1", async () => { it("should use in-battle overriden stats when determining the stat stage to raise by 1", async () => {
game.override.enemyMoveset([MoveId.GUARD_SPLIT]); game.override.enemyMoveset([MoveId.GUARD_SPLIT]);
@ -66,7 +66,7 @@ describe("Abilities - Beast Boost", () => {
await game.phaseInterceptor.to("VictoryPhase"); await game.phaseInterceptor.to("VictoryPhase");
expect(playerPokemon.getStatStage(Stat.SPATK)).toBe(1); expect(playerPokemon.getStatStage(Stat.SPATK)).toBe(1);
}, 20000); });
it("should have order preference in case of stat ties", async () => { it("should have order preference in case of stat ties", async () => {
// Order preference follows the order of EFFECTIVE_STAT // Order preference follows the order of EFFECTIVE_STAT
@ -84,5 +84,5 @@ describe("Abilities - Beast Boost", () => {
await game.phaseInterceptor.to("VictoryPhase"); await game.phaseInterceptor.to("VictoryPhase");
expect(playerPokemon.getStatStage(Stat.SPATK)).toBe(1); expect(playerPokemon.getStatStage(Stat.SPATK)).toBe(1);
}, 20000); });
}); });

View File

@ -36,7 +36,7 @@ describe("Abilities - Contrary", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!; const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(1); expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(1);
}, 20000); });
describe("With Clear Body", () => { describe("With Clear Body", () => {
it("should apply positive effects", async () => { it("should apply positive effects", async () => {

View File

@ -44,7 +44,7 @@ describe("Abilities - Flash Fire", () => {
game.move.select(MoveId.SPLASH); game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase); await game.phaseInterceptor.to(TurnEndPhase);
expect(blissey.hp).toBe(blissey.getMaxHp()); expect(blissey.hp).toBe(blissey.getMaxHp());
}, 20000); });
it("not activate if the Pokémon is protected from the Fire-type move", async () => { it("not activate if the Pokémon is protected from the Fire-type move", async () => {
game.override.enemyMoveset([MoveId.EMBER]).moveset([MoveId.PROTECT]); game.override.enemyMoveset([MoveId.EMBER]).moveset([MoveId.PROTECT]);
@ -55,7 +55,7 @@ describe("Abilities - Flash Fire", () => {
game.move.select(MoveId.PROTECT); game.move.select(MoveId.PROTECT);
await game.phaseInterceptor.to(TurnEndPhase); await game.phaseInterceptor.to(TurnEndPhase);
expect(blissey!.getTag(BattlerTagType.FIRE_BOOST)).toBeUndefined(); expect(blissey!.getTag(BattlerTagType.FIRE_BOOST)).toBeUndefined();
}, 20000); });
it("activated by Will-O-Wisp", async () => { it("activated by Will-O-Wisp", async () => {
game.override.enemyMoveset([MoveId.WILL_O_WISP]).moveset(MoveId.SPLASH); game.override.enemyMoveset([MoveId.WILL_O_WISP]).moveset(MoveId.SPLASH);
@ -70,7 +70,7 @@ describe("Abilities - Flash Fire", () => {
await game.phaseInterceptor.to(TurnEndPhase); await game.phaseInterceptor.to(TurnEndPhase);
expect(blissey!.getTag(BattlerTagType.FIRE_BOOST)).toBeDefined(); expect(blissey!.getTag(BattlerTagType.FIRE_BOOST)).toBeDefined();
}, 20000); });
it("activated after being frozen", async () => { it("activated after being frozen", async () => {
game.override.enemyMoveset([MoveId.EMBER]).moveset(MoveId.SPLASH).statusEffect(StatusEffect.FREEZE); game.override.enemyMoveset([MoveId.EMBER]).moveset(MoveId.SPLASH).statusEffect(StatusEffect.FREEZE);
@ -82,7 +82,7 @@ describe("Abilities - Flash Fire", () => {
await game.phaseInterceptor.to(TurnEndPhase); await game.phaseInterceptor.to(TurnEndPhase);
expect(blissey!.getTag(BattlerTagType.FIRE_BOOST)).toBeDefined(); expect(blissey!.getTag(BattlerTagType.FIRE_BOOST)).toBeDefined();
}, 20000); });
it("not passing with baton pass", async () => { it("not passing with baton pass", async () => {
game.override.enemyMoveset([MoveId.EMBER]).moveset([MoveId.BATON_PASS]); game.override.enemyMoveset([MoveId.EMBER]).moveset([MoveId.BATON_PASS]);
@ -98,7 +98,7 @@ describe("Abilities - Flash Fire", () => {
const chansey = game.scene.getPlayerPokemon()!; const chansey = game.scene.getPlayerPokemon()!;
expect(game.scene.getPlayerPokemon()!.species.speciesId).toBe(SpeciesId.CHANSEY); expect(game.scene.getPlayerPokemon()!.species.speciesId).toBe(SpeciesId.CHANSEY);
expect(chansey!.getTag(BattlerTagType.FIRE_BOOST)).toBeUndefined(); expect(chansey!.getTag(BattlerTagType.FIRE_BOOST)).toBeUndefined();
}, 20000); });
it("boosts Fire-type move when the ability is activated", async () => { it("boosts Fire-type move when the ability is activated", async () => {
game.override game.override
@ -126,7 +126,7 @@ describe("Abilities - Flash Fire", () => {
const flashFireDmg = initialHP - blissey.hp; const flashFireDmg = initialHP - blissey.hp;
expect(flashFireDmg).toBeGreaterThan(originalDmg); expect(flashFireDmg).toBeGreaterThan(originalDmg);
}, 20000); });
it("still activates regardless of accuracy check", async () => { it("still activates regardless of accuracy check", async () => {
game.override game.override
@ -158,5 +158,5 @@ describe("Abilities - Flash Fire", () => {
const flashFireDmg = initialHP - blissey.hp; const flashFireDmg = initialHP - blissey.hp;
expect(flashFireDmg).toBeGreaterThan(originalDmg); expect(flashFireDmg).toBeGreaterThan(originalDmg);
}, 20000); });
}); });

View File

@ -89,7 +89,6 @@ describe("Abilities - Flower Veil", () => {
await game.move.selectEnemyMove(MoveId.THUNDER_WAVE); await game.move.selectEnemyMove(MoveId.THUNDER_WAVE);
await game.toNextTurn(); await game.toNextTurn();
expect(game.scene.getPlayerPokemon()!.status).toBeUndefined(); expect(game.scene.getPlayerPokemon()!.status).toBeUndefined();
vi.spyOn(allMoves[MoveId.THUNDER_WAVE], "accuracy", "get").mockClear();
}); });
it("should not prevent status conditions for a non-grass user and its non-grass allies", async () => { it("should not prevent status conditions for a non-grass user and its non-grass allies", async () => {

View File

@ -4,17 +4,15 @@ import { SpeciesId } from "#enums/species-id";
import { StatusEffect } from "#enums/status-effect"; import { StatusEffect } from "#enums/status-effect";
import GameManager from "#test/testUtils/gameManager"; import GameManager from "#test/testUtils/gameManager";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi, type MockInstance } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { isNullOrUndefined } from "#app/utils/common"; import { isNullOrUndefined } from "#app/utils/common";
import { allAbilities } from "#app/data/data-lists"; import { allAbilities } from "#app/data/data-lists";
import type Pokemon from "#app/field/pokemon"; import type Pokemon from "#app/field/pokemon";
import type { PostTurnResetStatusAbAttr } from "#app/@types/ability-types"; import { PostTurnResetStatusAbAttr } from "#app/data/abilities/ability";
describe("Abilities - Healer", () => { describe("Abilities - Healer", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
let game: GameManager; let game: GameManager;
let healerAttrSpy: MockInstance;
let healerAttr: PostTurnResetStatusAbAttr;
beforeAll(() => { beforeAll(() => {
phaserGame = new Phaser.Game({ phaserGame = new Phaser.Game({
@ -24,7 +22,6 @@ describe("Abilities - Healer", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
healerAttrSpy.mockRestore();
}); });
beforeEach(() => { beforeEach(() => {
@ -38,30 +35,28 @@ describe("Abilities - Healer", () => {
.enemyAbility(AbilityId.BALL_FETCH) .enemyAbility(AbilityId.BALL_FETCH)
.enemyMoveset(MoveId.SPLASH); .enemyMoveset(MoveId.SPLASH);
healerAttr = allAbilities[AbilityId.HEALER].getAttrs("PostTurnResetStatusAbAttr")[0]; // Mock healer to have a 100% chance of healing its ally
healerAttrSpy = vi vi.spyOn(allAbilities[AbilityId.HEALER].getAttrs("PostTurnResetStatusAbAttr")[0], "getCondition").mockReturnValue(
.spyOn(healerAttr, "getCondition") (pokemon: Pokemon) => !isNullOrUndefined(pokemon.getAlly()),
.mockReturnValue((pokemon: Pokemon) => !isNullOrUndefined(pokemon.getAlly())); );
}); });
it("should not queue a message phase for healing if the ally has fainted", async () => { it("should not queue a message phase for healing if the ally has fainted", async () => {
const abSpy = vi.spyOn(PostTurnResetStatusAbAttr.prototype, "canApplyPostTurn");
game.override.moveset([MoveId.SPLASH, MoveId.LUNAR_DANCE]); game.override.moveset([MoveId.SPLASH, MoveId.LUNAR_DANCE]);
await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MAGIKARP]); await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MAGIKARP]);
const user = game.scene.getPlayerPokemon()!; const user = game.scene.getPlayerPokemon()!;
// Only want one magikarp to have the ability. // Only want one magikarp to have the ability
vi.spyOn(user, "getAbility").mockReturnValue(allAbilities[AbilityId.HEALER]); vi.spyOn(user, "getAbility").mockReturnValue(allAbilities[AbilityId.HEALER]);
game.move.select(MoveId.SPLASH); game.move.select(MoveId.SPLASH);
// faint the ally // faint the ally
game.move.select(MoveId.LUNAR_DANCE, 1); game.move.select(MoveId.LUNAR_DANCE, 1);
const abSpy = vi.spyOn(healerAttr, "canApplyPostTurn");
await game.phaseInterceptor.to("TurnEndPhase"); await game.phaseInterceptor.to("TurnEndPhase");
// It's not enough to just test that the ally still has its status. // It's not enough to just test that the ally still has its status.
// We need to ensure that the ability failed to meet its condition // We need to ensure that the ability failed to meet its condition
expect(abSpy).toHaveReturnedWith(false); expect(abSpy).toHaveReturnedWith(false);
// Explicitly restore the mock to ensure pollution doesn't happen
abSpy.mockRestore();
}); });
it("should heal the status of an ally if the ally has a status", async () => { it("should heal the status of an ally if the ally has a status", async () => {

View File

@ -62,7 +62,7 @@ describe("Abilities - Intimidate", () => {
expect(playerPokemon.species.speciesId).toBe(SpeciesId.POOCHYENA); expect(playerPokemon.species.speciesId).toBe(SpeciesId.POOCHYENA);
expect(playerPokemon.getStatStage(Stat.ATK)).toBe(0); expect(playerPokemon.getStatStage(Stat.ATK)).toBe(0);
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(-2); expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(-2);
}, 20000); });
it("should lower ATK stat stage by 1 for every enemy Pokemon in a double battle on entry", async () => { it("should lower ATK stat stage by 1 for every enemy Pokemon in a double battle on entry", async () => {
game.override.battleStyle("double").startingWave(3); game.override.battleStyle("double").startingWave(3);
@ -85,7 +85,7 @@ describe("Abilities - Intimidate", () => {
expect(enemyField[1].getStatStage(Stat.ATK)).toBe(-2); expect(enemyField[1].getStatStage(Stat.ATK)).toBe(-2);
expect(playerField[0].getStatStage(Stat.ATK)).toBe(-2); expect(playerField[0].getStatStage(Stat.ATK)).toBe(-2);
expect(playerField[1].getStatStage(Stat.ATK)).toBe(-2); expect(playerField[1].getStatStage(Stat.ATK)).toBe(-2);
}, 20000); });
it("should not activate again if there is no switch or new entry", async () => { it("should not activate again if there is no switch or new entry", async () => {
game.override.startingWave(2).moveset([MoveId.SPLASH]); game.override.startingWave(2).moveset([MoveId.SPLASH]);
@ -102,7 +102,7 @@ describe("Abilities - Intimidate", () => {
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(-1); expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(-1);
expect(playerPokemon.getStatStage(Stat.ATK)).toBe(-1); expect(playerPokemon.getStatStage(Stat.ATK)).toBe(-1);
}, 20000); });
it("should lower ATK stat stage by 1 for every switch", async () => { it("should lower ATK stat stage by 1 for every switch", async () => {
game.override.moveset([MoveId.SPLASH]).enemyMoveset([MoveId.VOLT_SWITCH]).startingWave(5); game.override.moveset([MoveId.SPLASH]).enemyMoveset([MoveId.VOLT_SWITCH]).startingWave(5);
@ -129,5 +129,5 @@ describe("Abilities - Intimidate", () => {
expect(playerPokemon.getStatStage(Stat.ATK)).toBe(-3); expect(playerPokemon.getStatStage(Stat.ATK)).toBe(-3);
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(0); expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(0);
}, 200000); });
}); });

View File

@ -39,5 +39,5 @@ describe("Abilities - Intrepid Sword", () => {
expect(playerPokemon.getStatStage(Stat.ATK)).toBe(1); expect(playerPokemon.getStatStage(Stat.ATK)).toBe(1);
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(1); expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(1);
}, 20000); });
}); });

View File

@ -49,7 +49,7 @@ describe("Abilities - Moxie", () => {
await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(VictoryPhase); await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(VictoryPhase);
expect(playerPokemon.getStatStage(Stat.ATK)).toBe(1); expect(playerPokemon.getStatStage(Stat.ATK)).toBe(1);
}, 20000); });
// TODO: Activate this test when MOXIE is corrected to work on faint and not on battle victory // TODO: Activate this test when MOXIE is corrected to work on faint and not on battle victory
it.todo( it.todo(

View File

@ -63,7 +63,7 @@ describe("Abilities - Mycelium Might", () => {
// Despite the opponent's ability (Clear Body), its ATK stat stage is still reduced. // Despite the opponent's ability (Clear Body), its ATK stat stage is still reduced.
expect(enemyPokemon?.getStatStage(Stat.ATK)).toBe(-1); expect(enemyPokemon?.getStatStage(Stat.ATK)).toBe(-1);
}, 20000); });
it("will still go first if a status move that is in a higher priority bracket than the opponent's move is used", async () => { it("will still go first if a status move that is in a higher priority bracket than the opponent's move is used", async () => {
game.override.enemyMoveset(MoveId.TACKLE); game.override.enemyMoveset(MoveId.TACKLE);
@ -86,7 +86,7 @@ describe("Abilities - Mycelium Might", () => {
await game.phaseInterceptor.to(TurnEndPhase); await game.phaseInterceptor.to(TurnEndPhase);
// Despite the opponent's ability (Clear Body), its ATK stat stage is still reduced. // Despite the opponent's ability (Clear Body), its ATK stat stage is still reduced.
expect(enemyPokemon?.getStatStage(Stat.ATK)).toBe(-1); expect(enemyPokemon?.getStatStage(Stat.ATK)).toBe(-1);
}, 20000); });
it("will not affect non-status moves", async () => { it("will not affect non-status moves", async () => {
await game.classicMode.startBattle([SpeciesId.REGIELEKI]); await game.classicMode.startBattle([SpeciesId.REGIELEKI]);
@ -105,5 +105,5 @@ describe("Abilities - Mycelium Might", () => {
// This means that the commandOrder should be identical to the speedOrder // This means that the commandOrder should be identical to the speedOrder
expect(speedOrder).toEqual([playerIndex, enemyIndex]); expect(speedOrder).toEqual([playerIndex, enemyIndex]);
expect(commandOrder).toEqual([playerIndex, enemyIndex]); expect(commandOrder).toEqual([playerIndex, enemyIndex]);
}, 20000); });
}); });

View File

@ -54,8 +54,8 @@ describe("Abilities - Quick Draw", () => {
expect(pokemon.isFainted()).toBe(false); expect(pokemon.isFainted()).toBe(false);
expect(enemy.isFainted()).toBe(true); expect(enemy.isFainted()).toBe(true);
expect(pokemon.waveData.abilitiesApplied).contain(AbilityId.QUICK_DRAW); expect(pokemon.waveData.abilitiesApplied).toContain(AbilityId.QUICK_DRAW);
}, 20000); });
test( test(
"does not triggered by non damage moves", "does not triggered by non damage moves",
@ -96,6 +96,6 @@ describe("Abilities - Quick Draw", () => {
expect(pokemon.isFainted()).toBe(true); expect(pokemon.isFainted()).toBe(true);
expect(enemy.isFainted()).toBe(false); expect(enemy.isFainted()).toBe(false);
expect(pokemon.waveData.abilitiesApplied).contain(AbilityId.QUICK_DRAW); expect(pokemon.waveData.abilitiesApplied).toContain(AbilityId.QUICK_DRAW);
}, 20000); });
}); });

View File

@ -40,7 +40,7 @@ describe("Abilities - Sand Spit", () => {
await game.toNextTurn(); await game.toNextTurn();
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SANDSTORM); expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SANDSTORM);
}, 20000); });
it("should trigger even when fainting", async () => { it("should trigger even when fainting", async () => {
game.override.enemyMoveset([MoveId.TACKLE]).enemyLevel(100).startingLevel(1); game.override.enemyMoveset([MoveId.TACKLE]).enemyLevel(100).startingLevel(1);
@ -61,5 +61,5 @@ describe("Abilities - Sand Spit", () => {
await game.toNextTurn(); await game.toNextTurn();
expect(game.scene.arena.weather?.weatherType).not.toBe(WeatherType.SANDSTORM); expect(game.scene.arena.weather?.weatherType).not.toBe(WeatherType.SANDSTORM);
}, 20000); });
}); });

View File

@ -69,7 +69,7 @@ describe("Abilities - Sheer Force", () => {
await game.phaseInterceptor.to("BerryPhase", false); await game.phaseInterceptor.to("BerryPhase", false);
expect(bindMove.calculateBattlePower).toHaveLastReturnedWith(bindMove.power); expect(bindMove.calculateBattlePower).toHaveLastReturnedWith(bindMove.power);
}, 20000); });
it("Sheer Force does not boost the base damage of moves with no secondary effect", async () => { it("Sheer Force does not boost the base damage of moves with no secondary effect", async () => {
game.override.moveset([MoveId.TACKLE]); game.override.moveset([MoveId.TACKLE]);

View File

@ -36,5 +36,5 @@ describe("Abilities - Simple", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!; const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(-2); expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(-2);
}, 20000); });
}); });

View File

@ -53,7 +53,7 @@ describe("Abilities - Stall", () => {
// The opponent Pokemon (with Stall) goes last despite having higher speed than the player Pokemon. // The opponent Pokemon (with Stall) goes last despite having higher speed than the player Pokemon.
expect(speedOrder).toEqual([enemyIndex, playerIndex]); expect(speedOrder).toEqual([enemyIndex, playerIndex]);
expect(commandOrder).toEqual([playerIndex, enemyIndex]); expect(commandOrder).toEqual([playerIndex, enemyIndex]);
}, 20000); });
it("Pokemon with Stall will go first if a move that is in a higher priority bracket than the opponent's move is used", async () => { it("Pokemon with Stall will go first if a move that is in a higher priority bracket than the opponent's move is used", async () => {
await game.classicMode.startBattle([SpeciesId.SHUCKLE]); await game.classicMode.startBattle([SpeciesId.SHUCKLE]);
@ -71,7 +71,7 @@ describe("Abilities - Stall", () => {
// The player Pokemon goes second because its move is in a lower priority bracket. // The player Pokemon goes second because its move is in a lower priority bracket.
expect(speedOrder).toEqual([enemyIndex, playerIndex]); expect(speedOrder).toEqual([enemyIndex, playerIndex]);
expect(commandOrder).toEqual([enemyIndex, playerIndex]); expect(commandOrder).toEqual([enemyIndex, playerIndex]);
}, 20000); });
it("If both Pokemon have stall and use the same move, speed is used to determine who goes first.", async () => { it("If both Pokemon have stall and use the same move, speed is used to determine who goes first.", async () => {
game.override.ability(AbilityId.STALL); game.override.ability(AbilityId.STALL);
@ -91,5 +91,5 @@ describe("Abilities - Stall", () => {
// The player Pokemon (with Stall) goes second because its speed is lower. // The player Pokemon (with Stall) goes second because its speed is lower.
expect(speedOrder).toEqual([enemyIndex, playerIndex]); expect(speedOrder).toEqual([enemyIndex, playerIndex]);
expect(commandOrder).toEqual([enemyIndex, playerIndex]); expect(commandOrder).toEqual([enemyIndex, playerIndex]);
}, 20000); });
}); });

View File

@ -30,13 +30,13 @@ describe("Abilities - Super Luck", () => {
.enemyMoveset(MoveId.SPLASH); .enemyMoveset(MoveId.SPLASH);
}); });
it("should increase the crit stage of a user by 1", async () => { it("should increase the user's crit stage by 1", async () => {
await game.classicMode.startBattle([SpeciesId.MAGIKARP]); await game.classicMode.startBattle([SpeciesId.MAGIKARP]);
const enemy = game.scene.getEnemyPokemon()!; const enemy = game.scene.getEnemyPokemon()!;
const fn = vi.spyOn(enemy, "getCritStage"); const critSpy = vi.spyOn(enemy, "getCritStage"); // crit stage is called on enemy
game.move.select(MoveId.TACKLE); game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to("BerryPhase"); await game.phaseInterceptor.to("BerryPhase");
expect(fn).toHaveReturnedWith(1); expect(critSpy).toHaveReturnedWith(1);
fn.mockRestore();
}); });
}); });

View File

@ -93,8 +93,6 @@ describe("Abilities - Tera Shell", () => {
await game.phaseInterceptor.to("BerryPhase", false); await game.phaseInterceptor.to("BerryPhase", false);
expect(spy).toHaveLastReturnedWith(1); expect(spy).toHaveLastReturnedWith(1);
expect(playerPokemon.hp).toBe(playerPokemon.getMaxHp() - 40); expect(playerPokemon.hp).toBe(playerPokemon.getMaxHp() - 40);
spy.mockRestore();
}); });
it("should change the effectiveness of all strikes of a multi-strike move", async () => { it("should change the effectiveness of all strikes of a multi-strike move", async () => {
@ -114,6 +112,5 @@ describe("Abilities - Tera Shell", () => {
expect(spy).toHaveLastReturnedWith(0.5); expect(spy).toHaveLastReturnedWith(0.5);
} }
expect(spy).toHaveReturnedTimes(2); expect(spy).toHaveReturnedTimes(2);
spy.mockRestore();
}); });
}); });

View File

@ -49,7 +49,7 @@ describe("Battle order", () => {
const order = phase.getCommandOrder(); const order = phase.getCommandOrder();
expect(order[0]).toBe(enemyPokemonIndex); expect(order[0]).toBe(enemyPokemonIndex);
expect(order[1]).toBe(playerPokemonIndex); expect(order[1]).toBe(playerPokemonIndex);
}, 20000); });
it("Player faster than opponent 150 vs 50", async () => { it("Player faster than opponent 150 vs 50", async () => {
await game.classicMode.startBattle([SpeciesId.BULBASAUR]); await game.classicMode.startBattle([SpeciesId.BULBASAUR]);
@ -68,7 +68,7 @@ describe("Battle order", () => {
const order = phase.getCommandOrder(); const order = phase.getCommandOrder();
expect(order[0]).toBe(playerPokemonIndex); expect(order[0]).toBe(playerPokemonIndex);
expect(order[1]).toBe(enemyPokemonIndex); expect(order[1]).toBe(enemyPokemonIndex);
}, 20000); });
it("double - both opponents faster than player 50/50 vs 150/150", async () => { it("double - both opponents faster than player 50/50 vs 150/150", async () => {
game.override.battleStyle("double"); game.override.battleStyle("double");
@ -92,7 +92,7 @@ describe("Battle order", () => {
expect(order.slice(0, 2).includes(enemyIndices[1])).toBe(true); expect(order.slice(0, 2).includes(enemyIndices[1])).toBe(true);
expect(order.slice(2, 4).includes(playerIndices[0])).toBe(true); expect(order.slice(2, 4).includes(playerIndices[0])).toBe(true);
expect(order.slice(2, 4).includes(playerIndices[1])).toBe(true); expect(order.slice(2, 4).includes(playerIndices[1])).toBe(true);
}, 20000); });
it("double - speed tie except 1 - 100/100 vs 100/150", async () => { it("double - speed tie except 1 - 100/100 vs 100/150", async () => {
game.override.battleStyle("double"); game.override.battleStyle("double");
@ -112,11 +112,10 @@ describe("Battle order", () => {
const phase = game.scene.phaseManager.getCurrentPhase() as TurnStartPhase; const phase = game.scene.phaseManager.getCurrentPhase() as TurnStartPhase;
const order = phase.getCommandOrder(); const order = phase.getCommandOrder();
// enemy 2 should be first, followed by some other assortment of the other 3 pokemon
expect(order[0]).toBe(enemyIndices[1]); expect(order[0]).toBe(enemyIndices[1]);
expect(order.slice(1, 4).includes(enemyIndices[0])).toBe(true); expect(order.slice(1, 4)).toEqual(expect.arrayContaining([enemyIndices[0], ...playerIndices]));
expect(order.slice(1, 4).includes(playerIndices[0])).toBe(true); });
expect(order.slice(1, 4).includes(playerIndices[1])).toBe(true);
}, 20000);
it("double - speed tie 100/150 vs 100/150", async () => { it("double - speed tie 100/150 vs 100/150", async () => {
game.override.battleStyle("double"); game.override.battleStyle("double");
@ -137,9 +136,8 @@ describe("Battle order", () => {
const phase = game.scene.phaseManager.getCurrentPhase() as TurnStartPhase; const phase = game.scene.phaseManager.getCurrentPhase() as TurnStartPhase;
const order = phase.getCommandOrder(); const order = phase.getCommandOrder();
expect(order.slice(0, 2).includes(playerIndices[1])).toBe(true); // P2/E2 should be randomly first/second, then P1/E1 randomly 3rd/4th
expect(order.slice(0, 2).includes(enemyIndices[1])).toBe(true); expect(order.slice(0, 2)).toStrictEqual(expect.arrayContaining([playerIndices[1], enemyIndices[1]]));
expect(order.slice(2, 4).includes(playerIndices[0])).toBe(true); expect(order.slice(2, 4)).toStrictEqual(expect.arrayContaining([playerIndices[0], enemyIndices[0]]));
expect(order.slice(2, 4).includes(enemyIndices[0])).toBe(true); });
}, 20000);
}); });

View File

@ -60,7 +60,7 @@ describe("Test Battle Phase", () => {
expect(game.scene.ui?.getMode()).toBe(UiMode.TITLE); expect(game.scene.ui?.getMode()).toBe(UiMode.TITLE);
expect(game.scene.gameData.gender).toBe(PlayerGender.MALE); expect(game.scene.gameData.gender).toBe(PlayerGender.MALE);
}, 20000); });
it("test phase interceptor with prompt with preparation for a future prompt", async () => { it("test phase interceptor with prompt with preparation for a future prompt", async () => {
await game.phaseInterceptor.run(LoginPhase); await game.phaseInterceptor.run(LoginPhase);
@ -81,20 +81,20 @@ describe("Test Battle Phase", () => {
expect(game.scene.ui?.getMode()).toBe(UiMode.TITLE); expect(game.scene.ui?.getMode()).toBe(UiMode.TITLE);
expect(game.scene.gameData.gender).toBe(PlayerGender.MALE); expect(game.scene.gameData.gender).toBe(PlayerGender.MALE);
}, 20000); });
it("newGame one-liner", async () => { it("newGame one-liner", async () => {
await game.classicMode.startBattle(); await game.classicMode.startBattle();
expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND); expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND);
expect(game.scene.phaseManager.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); expect(game.scene.phaseManager.getCurrentPhase()?.phaseName).toBe("CommandPhase");
}, 20000); });
it("do attack wave 3 - single battle - regular - OHKO", async () => { it("do attack wave 3 - single battle - regular - OHKO", async () => {
game.override.enemySpecies(SpeciesId.RATTATA).startingLevel(2000).battleStyle("single"); game.override.enemySpecies(SpeciesId.RATTATA).startingLevel(2000).battleStyle("single").startingWave(3);
await game.classicMode.startBattle([SpeciesId.MEWTWO]); await game.classicMode.startBattle([SpeciesId.MEWTWO]);
game.move.use(MoveId.TACKLE); game.move.use(MoveId.TACKLE);
await game.phaseInterceptor.to("SelectModifierPhase"); await game.phaseInterceptor.to("SelectModifierPhase");
}, 20000); });
it("do attack wave 3 - single battle - regular - NO OHKO with opponent using non damage attack", async () => { it("do attack wave 3 - single battle - regular - NO OHKO with opponent using non damage attack", async () => {
game.override game.override
@ -108,7 +108,7 @@ describe("Test Battle Phase", () => {
await game.classicMode.startBattle([SpeciesId.MEWTWO]); await game.classicMode.startBattle([SpeciesId.MEWTWO]);
game.move.select(MoveId.TACKLE); game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(TurnInitPhase, false); await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(TurnInitPhase, false);
}, 20000); });
it("load 100% data file", async () => { it("load 100% data file", async () => {
await game.importData("./test/testUtils/saves/everything.prsv"); await game.importData("./test/testUtils/saves/everything.prsv");
@ -117,14 +117,16 @@ describe("Test Battle Phase", () => {
return species.caughtAttr !== 0n; return species.caughtAttr !== 0n;
}).length; }).length;
expect(caughtCount).toBe(Object.keys(allSpecies).length); expect(caughtCount).toBe(Object.keys(allSpecies).length);
}, 20000); });
it("start battle with selected team", async () => { it("start battle with selected team", async () => {
await game.classicMode.startBattle([SpeciesId.CHARIZARD, SpeciesId.CHANSEY, SpeciesId.MEW]); await game.classicMode.startBattle([SpeciesId.CHARIZARD, SpeciesId.CHANSEY, SpeciesId.MEW]);
expect(game.scene.getPlayerParty()[0].species.speciesId).toBe(SpeciesId.CHARIZARD); expect(game.scene.getPlayerParty().map(p => p.species.speciesId)).toEqual([
expect(game.scene.getPlayerParty()[1].species.speciesId).toBe(SpeciesId.CHANSEY); SpeciesId.CHARIZARD,
expect(game.scene.getPlayerParty()[2].species.speciesId).toBe(SpeciesId.MEW); SpeciesId.CHANSEY,
}, 20000); SpeciesId.MEW,
]);
});
it("test remove random battle seed int", async () => { it("test remove random battle seed int", async () => {
for (let i = 0; i < 10; i++) { for (let i = 0; i < 10; i++) {
@ -138,12 +140,12 @@ describe("Test Battle Phase", () => {
await game.phaseInterceptor.run(LoginPhase).catch(e => { await game.phaseInterceptor.run(LoginPhase).catch(e => {
expect(e).toBe("Wrong phase: this is SelectGenderPhase and not LoginPhase"); expect(e).toBe("Wrong phase: this is SelectGenderPhase and not LoginPhase");
}); });
}, 20000); });
it("wrong phase but skip", async () => { it("wrong phase but skip", async () => {
await game.phaseInterceptor.run(LoginPhase); await game.phaseInterceptor.run(LoginPhase);
await game.phaseInterceptor.run(LoginPhase, () => game.isCurrentPhase(SelectGenderPhase)); await game.phaseInterceptor.run(LoginPhase, () => game.isCurrentPhase(SelectGenderPhase));
}, 20000); });
it("good run", async () => { it("good run", async () => {
await game.phaseInterceptor.run(LoginPhase); await game.phaseInterceptor.run(LoginPhase);
@ -158,7 +160,7 @@ describe("Test Battle Phase", () => {
); );
await game.phaseInterceptor.run(SelectGenderPhase, () => game.isCurrentPhase(TitlePhase)); await game.phaseInterceptor.run(SelectGenderPhase, () => game.isCurrentPhase(TitlePhase));
await game.phaseInterceptor.run(TitlePhase); await game.phaseInterceptor.run(TitlePhase);
}, 20000); });
it("good run from select gender to title", async () => { it("good run from select gender to title", async () => {
await game.phaseInterceptor.run(LoginPhase); await game.phaseInterceptor.run(LoginPhase);
@ -172,7 +174,7 @@ describe("Test Battle Phase", () => {
() => game.isCurrentPhase(TitlePhase), () => game.isCurrentPhase(TitlePhase),
); );
await game.phaseInterceptor.runFrom(SelectGenderPhase).to(TitlePhase); await game.phaseInterceptor.runFrom(SelectGenderPhase).to(TitlePhase);
}, 20000); });
it("good run to SummonPhase phase", async () => { it("good run to SummonPhase phase", async () => {
await game.phaseInterceptor.run(LoginPhase); await game.phaseInterceptor.run(LoginPhase);
@ -193,7 +195,7 @@ describe("Test Battle Phase", () => {
selectStarterPhase.initBattle(starters); selectStarterPhase.initBattle(starters);
}); });
await game.phaseInterceptor.runFrom(SelectGenderPhase).to(SummonPhase); await game.phaseInterceptor.runFrom(SelectGenderPhase).to(SummonPhase);
}, 20000); });
it("2vs1", async () => { it("2vs1", async () => {
game.override.battleStyle("single"); game.override.battleStyle("single");
@ -274,7 +276,7 @@ describe("Test Battle Phase", () => {
game.move.select(moveToUse); game.move.select(moveToUse);
await game.toNextTurn(); await game.toNextTurn();
expect(game.scene.currentBattle.turn).toBeGreaterThan(turn); expect(game.scene.currentBattle.turn).toBeGreaterThan(turn);
}, 20000); });
it("does not set new weather if staying in same biome", async () => { it("does not set new weather if staying in same biome", async () => {
const moveToUse = MoveId.SPLASH; const moveToUse = MoveId.SPLASH;
@ -298,7 +300,7 @@ describe("Test Battle Phase", () => {
await game.toNextWave(); await game.toNextWave();
expect(game.scene.arena.trySetWeather).not.toHaveBeenCalled(); expect(game.scene.arena.trySetWeather).not.toHaveBeenCalled();
expect(game.scene.currentBattle.waveIndex).toBeGreaterThan(waveIndex); expect(game.scene.currentBattle.waveIndex).toBeGreaterThan(waveIndex);
}, 20000); });
it("does not force switch if active pokemon faints at same time as enemy mon and is revived in post-battle", async () => { it("does not force switch if active pokemon faints at same time as enemy mon and is revived in post-battle", async () => {
const moveToUse = MoveId.TAKE_DOWN; const moveToUse = MoveId.TAKE_DOWN;
@ -329,5 +331,5 @@ describe("Test Battle Phase", () => {
() => game.isCurrentPhase(NextEncounterPhase), () => game.isCurrentPhase(NextEncounterPhase),
); );
await game.phaseInterceptor.to(SwitchPhase); await game.phaseInterceptor.to(SwitchPhase);
}, 20000); });
}); });

View File

@ -56,7 +56,7 @@ describe("Double Battles", () => {
await game.phaseInterceptor.to(TurnInitPhase); await game.phaseInterceptor.to(TurnInitPhase);
expect(game.scene.getPlayerField().filter(p => !p.isFainted())).toHaveLength(2); expect(game.scene.getPlayerField().filter(p => !p.isFainted())).toHaveLength(2);
}, 20000); });
it("randomly chooses between single and double battles if there is no battle type override", async () => { it("randomly chooses between single and double battles if there is no battle type override", async () => {
let rngSweepProgress = 0; // Will simulate RNG rolls by slowly increasing from 0 to 1 let rngSweepProgress = 0; // Will simulate RNG rolls by slowly increasing from 0 to 1

View File

@ -1,4 +1,3 @@
import { CommandPhase } from "#app/phases/command-phase";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import { AbilityId } from "#enums/ability-id"; import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id"; import { MoveId } from "#enums/move-id";
@ -32,66 +31,67 @@ describe("Test Battle Phase", () => {
.enemyMoveset(MoveId.TACKLE); .enemyMoveset(MoveId.TACKLE);
}); });
// TODO: Make these into `it.each`es
it("startBattle 2vs1 boss", async () => { it("startBattle 2vs1 boss", async () => {
game.override.battleStyle("single").startingWave(10); game.override.battleStyle("single").startingWave(10);
await game.classicMode.startBattle([SpeciesId.BLASTOISE, SpeciesId.CHARIZARD]); await game.classicMode.startBattle([SpeciesId.BLASTOISE, SpeciesId.CHARIZARD]);
expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND); expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND);
expect(game.scene.phaseManager.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); expect(game.scene.phaseManager.getCurrentPhase()?.phaseName).toBe("CommandPhase");
}, 20000); });
it("startBattle 2vs2 boss", async () => { it("startBattle 2vs2 boss", async () => {
game.override.battleStyle("double").startingWave(10); game.override.battleStyle("double").startingWave(10);
await game.classicMode.startBattle([SpeciesId.BLASTOISE, SpeciesId.CHARIZARD]); await game.classicMode.startBattle([SpeciesId.BLASTOISE, SpeciesId.CHARIZARD]);
expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND); expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND);
expect(game.scene.phaseManager.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); expect(game.scene.phaseManager.getCurrentPhase()?.phaseName).toBe("CommandPhase");
}, 20000); });
it("startBattle 2vs2 trainer", async () => { it("startBattle 2vs2 trainer", async () => {
game.override.battleStyle("double").startingWave(5); game.override.battleStyle("double").startingWave(5);
await game.classicMode.startBattle([SpeciesId.BLASTOISE, SpeciesId.CHARIZARD]); await game.classicMode.startBattle([SpeciesId.BLASTOISE, SpeciesId.CHARIZARD]);
expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND); expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND);
expect(game.scene.phaseManager.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); expect(game.scene.phaseManager.getCurrentPhase()?.phaseName).toBe("CommandPhase");
}, 20000); });
it("startBattle 2vs1 trainer", async () => { it("startBattle 2vs1 trainer", async () => {
game.override.battleStyle("single").startingWave(5); game.override.battleStyle("single").startingWave(5);
await game.classicMode.startBattle([SpeciesId.BLASTOISE, SpeciesId.CHARIZARD]); await game.classicMode.startBattle([SpeciesId.BLASTOISE, SpeciesId.CHARIZARD]);
expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND); expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND);
expect(game.scene.phaseManager.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); expect(game.scene.phaseManager.getCurrentPhase()?.phaseName).toBe("CommandPhase");
}, 20000); });
it("startBattle 2vs1 rival", async () => { it("startBattle 2vs1 rival", async () => {
game.override.battleStyle("single").startingWave(8); game.override.battleStyle("single").startingWave(8);
await game.classicMode.startBattle([SpeciesId.BLASTOISE, SpeciesId.CHARIZARD]); await game.classicMode.startBattle([SpeciesId.BLASTOISE, SpeciesId.CHARIZARD]);
expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND); expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND);
expect(game.scene.phaseManager.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); expect(game.scene.phaseManager.getCurrentPhase()?.phaseName).toBe("CommandPhase");
}, 20000); });
it("startBattle 2vs2 rival", async () => { it("startBattle 2vs2 rival", async () => {
game.override.battleStyle("double").startingWave(8); game.override.battleStyle("double").startingWave(8);
await game.classicMode.startBattle([SpeciesId.BLASTOISE, SpeciesId.CHARIZARD]); await game.classicMode.startBattle([SpeciesId.BLASTOISE, SpeciesId.CHARIZARD]);
expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND); expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND);
expect(game.scene.phaseManager.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); expect(game.scene.phaseManager.getCurrentPhase()?.phaseName).toBe("CommandPhase");
}, 20000); });
it("startBattle 1vs1 trainer", async () => { it("startBattle 1vs1 trainer", async () => {
game.override.battleStyle("single").startingWave(5); game.override.battleStyle("single").startingWave(5);
await game.classicMode.startBattle([SpeciesId.BLASTOISE]); await game.classicMode.startBattle([SpeciesId.BLASTOISE]);
expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND); expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND);
expect(game.scene.phaseManager.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); expect(game.scene.phaseManager.getCurrentPhase()?.phaseName).toBe("CommandPhase");
}, 20000); });
it("startBattle 2vs2 trainer", async () => { it("startBattle 2vs2 trainer", async () => {
game.override.battleStyle("double").startingWave(5); game.override.battleStyle("double").startingWave(5);
await game.classicMode.startBattle([SpeciesId.BLASTOISE, SpeciesId.CHARIZARD]); await game.classicMode.startBattle([SpeciesId.BLASTOISE, SpeciesId.CHARIZARD]);
expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND); expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND);
expect(game.scene.phaseManager.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); expect(game.scene.phaseManager.getCurrentPhase()?.phaseName).toBe("CommandPhase");
}, 20000); });
it("startBattle 4vs2 trainer", async () => { it("startBattle 4vs2 trainer", async () => {
game.override.battleStyle("double").startingWave(5); game.override.battleStyle("double").startingWave(5);
await game.classicMode.startBattle([SpeciesId.BLASTOISE, SpeciesId.CHARIZARD, SpeciesId.DARKRAI, SpeciesId.GABITE]); await game.classicMode.startBattle([SpeciesId.BLASTOISE, SpeciesId.CHARIZARD, SpeciesId.DARKRAI, SpeciesId.GABITE]);
expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND); expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND);
expect(game.scene.phaseManager.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name); expect(game.scene.phaseManager.getCurrentPhase()?.phaseName).toBe("CommandPhase");
}, 20000); });
}); });

View File

@ -13,7 +13,7 @@ import { SpeciesId } from "#enums/species-id";
import { StatusEffect } from "#enums/status-effect"; import { StatusEffect } from "#enums/status-effect";
import GameManager from "#test/testUtils/gameManager"; import GameManager from "#test/testUtils/gameManager";
import { mockI18next } from "#test/testUtils/testUtils"; import { mockI18next } from "#test/testUtils/testUtils";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
const pokemonName = "PKM"; const pokemonName = "PKM";
const sourceText = "SOURCE"; const sourceText = "SOURCE";
@ -294,10 +294,6 @@ describe("Status Effect Messages", () => {
expect(text).toBe("statusEffect:burn.overlap"); expect(text).toBe("statusEffect:burn.overlap");
}); });
}); });
afterEach(() => {
vi.resetAllMocks();
});
}); });
describe("Status Effects", () => { describe("Status Effects", () => {

View File

@ -25,7 +25,6 @@ describe("Egg Generation Tests", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.restoreAllMocks();
}); });
beforeEach(async () => { beforeEach(async () => {

View File

@ -21,7 +21,6 @@ describe("Manaphy Eggs", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.restoreAllMocks();
}); });
beforeEach(async () => { beforeEach(async () => {

View File

@ -94,7 +94,7 @@ describe("Escape chance calculations", () => {
phase.attemptRunAway(playerPokemon, enemyField, escapePercentage); phase.attemptRunAway(playerPokemon, enemyField, escapePercentage);
expect(escapePercentage.value).toBe(escapeChances[i].expectedEscapeChance); expect(escapePercentage.value).toBe(escapeChances[i].expectedEscapeChance);
} }
}, 20000); });
it("double non-boss opponent", async () => { it("double non-boss opponent", async () => {
game.override.battleStyle("double"); game.override.battleStyle("double");
@ -180,7 +180,7 @@ describe("Escape chance calculations", () => {
escapeChances[i].pokemonSpeedRatio * totalEnemySpeed, escapeChances[i].pokemonSpeedRatio * totalEnemySpeed,
); );
} }
}, 20000); });
it("single boss opponent", async () => { it("single boss opponent", async () => {
game.override.startingWave(10); game.override.startingWave(10);
@ -259,7 +259,7 @@ describe("Escape chance calculations", () => {
phase.attemptRunAway(playerPokemon, enemyField, escapePercentage); phase.attemptRunAway(playerPokemon, enemyField, escapePercentage);
expect(escapePercentage.value).toBe(escapeChances[i].expectedEscapeChance); expect(escapePercentage.value).toBe(escapeChances[i].expectedEscapeChance);
} }
}, 20000); });
it("double boss opponent", async () => { it("double boss opponent", async () => {
game.override.battleStyle("double").startingWave(10); game.override.battleStyle("double").startingWave(10);
@ -357,5 +357,5 @@ describe("Escape chance calculations", () => {
escapeChances[i].pokemonSpeedRatio * totalEnemySpeed, escapeChances[i].pokemonSpeedRatio * totalEnemySpeed,
); );
} }
}, 20000); });
}); });

View File

@ -15,8 +15,6 @@ describe("game-mode", () => {
}); });
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
}); });
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);

View File

@ -37,7 +37,7 @@ describe("Items - Dire Hit", () => {
.moveset([MoveId.POUND]) .moveset([MoveId.POUND])
.startingHeldItems([{ name: "DIRE_HIT" }]) .startingHeldItems([{ name: "DIRE_HIT" }])
.battleStyle("single"); .battleStyle("single");
}, 20000); });
it("should raise CRIT stage by 1", async () => { it("should raise CRIT stage by 1", async () => {
await game.classicMode.startBattle([SpeciesId.GASTLY]); await game.classicMode.startBattle([SpeciesId.GASTLY]);
@ -51,7 +51,7 @@ describe("Items - Dire Hit", () => {
await game.phaseInterceptor.to(TurnEndPhase); await game.phaseInterceptor.to(TurnEndPhase);
expect(enemyPokemon.getCritStage).toHaveReturnedWith(1); expect(enemyPokemon.getCritStage).toHaveReturnedWith(1);
}, 20000); });
it("should renew how many battles are left of existing DIRE_HIT when picking up new DIRE_HIT", async () => { it("should renew how many battles are left of existing DIRE_HIT when picking up new DIRE_HIT", async () => {
game.override.itemRewards([{ name: "DIRE_HIT" }]); game.override.itemRewards([{ name: "DIRE_HIT" }]);
@ -93,5 +93,5 @@ describe("Items - Dire Hit", () => {
} }
} }
expect(count).toBe(1); expect(count).toBe(1);
}, 20000); });
}); });

View File

@ -34,5 +34,5 @@ describe("EXP Modifier Items", () => {
const expHolder = new NumberHolder(partyMember.exp); const expHolder = new NumberHolder(partyMember.exp);
game.scene.applyModifiers(PokemonExpBoosterModifier, true, partyMember, expHolder); game.scene.applyModifiers(PokemonExpBoosterModifier, true, partyMember, expHolder);
expect(expHolder.value).toBe(440); expect(expHolder.value).toBe(440);
}, 20000); });
}); });

View File

@ -43,7 +43,7 @@ describe("Items - Leek", () => {
await game.phaseInterceptor.to(TurnEndPhase); await game.phaseInterceptor.to(TurnEndPhase);
expect(enemyMember.getCritStage).toHaveReturnedWith(2); expect(enemyMember.getCritStage).toHaveReturnedWith(2);
}, 20000); });
it("should raise CRIT stage by 2 when held by GALAR_FARFETCHD", async () => { it("should raise CRIT stage by 2 when held by GALAR_FARFETCHD", async () => {
await game.classicMode.startBattle([SpeciesId.GALAR_FARFETCHD]); await game.classicMode.startBattle([SpeciesId.GALAR_FARFETCHD]);
@ -57,7 +57,7 @@ describe("Items - Leek", () => {
await game.phaseInterceptor.to(TurnEndPhase); await game.phaseInterceptor.to(TurnEndPhase);
expect(enemyMember.getCritStage).toHaveReturnedWith(2); expect(enemyMember.getCritStage).toHaveReturnedWith(2);
}, 20000); });
it("should raise CRIT stage by 2 when held by SIRFETCHD", async () => { it("should raise CRIT stage by 2 when held by SIRFETCHD", async () => {
await game.classicMode.startBattle([SpeciesId.SIRFETCHD]); await game.classicMode.startBattle([SpeciesId.SIRFETCHD]);
@ -71,7 +71,7 @@ describe("Items - Leek", () => {
await game.phaseInterceptor.to(TurnEndPhase); await game.phaseInterceptor.to(TurnEndPhase);
expect(enemyMember.getCritStage).toHaveReturnedWith(2); expect(enemyMember.getCritStage).toHaveReturnedWith(2);
}, 20000); });
it("should raise CRIT stage by 2 when held by FARFETCHD line fused with Pokemon", async () => { it("should raise CRIT stage by 2 when held by FARFETCHD line fused with Pokemon", async () => {
// Randomly choose from the Farfetch'd line // Randomly choose from the Farfetch'd line
@ -99,7 +99,7 @@ describe("Items - Leek", () => {
await game.phaseInterceptor.to(TurnEndPhase); await game.phaseInterceptor.to(TurnEndPhase);
expect(enemyMember.getCritStage).toHaveReturnedWith(2); expect(enemyMember.getCritStage).toHaveReturnedWith(2);
}, 20000); });
it("should raise CRIT stage by 2 when held by Pokemon fused with FARFETCHD line", async () => { it("should raise CRIT stage by 2 when held by Pokemon fused with FARFETCHD line", async () => {
// Randomly choose from the Farfetch'd line // Randomly choose from the Farfetch'd line
@ -127,7 +127,7 @@ describe("Items - Leek", () => {
await game.phaseInterceptor.to(TurnEndPhase); await game.phaseInterceptor.to(TurnEndPhase);
expect(enemyMember.getCritStage).toHaveReturnedWith(2); expect(enemyMember.getCritStage).toHaveReturnedWith(2);
}, 20000); });
it("should not raise CRIT stage when held by a Pokemon outside of FARFETCHD line", async () => { it("should not raise CRIT stage when held by a Pokemon outside of FARFETCHD line", async () => {
await game.classicMode.startBattle([SpeciesId.PIKACHU]); await game.classicMode.startBattle([SpeciesId.PIKACHU]);
@ -141,5 +141,5 @@ describe("Items - Leek", () => {
await game.phaseInterceptor.to(TurnEndPhase); await game.phaseInterceptor.to(TurnEndPhase);
expect(enemyMember.getCritStage).toHaveReturnedWith(0); expect(enemyMember.getCritStage).toHaveReturnedWith(0);
}, 20000); });
}); });

View File

@ -56,5 +56,5 @@ describe("Items - Leftovers", () => {
// Check if leftovers heal us // Check if leftovers heal us
await game.phaseInterceptor.to(TurnEndPhase); await game.phaseInterceptor.to(TurnEndPhase);
expect(leadPokemon.hp).toBeGreaterThan(leadHpAfterDamage); expect(leadPokemon.hp).toBeGreaterThan(leadHpAfterDamage);
}, 20000); });
}); });

View File

@ -108,7 +108,7 @@ describe("Items - Light Ball", () => {
expect(atkValue.value / atkStat).toBe(2); expect(atkValue.value / atkStat).toBe(2);
expect(spAtkValue.value / spAtkStat).toBe(2); expect(spAtkValue.value / spAtkStat).toBe(2);
}, 20000); });
it("LIGHT_BALL held by fused PIKACHU (base)", async () => { it("LIGHT_BALL held by fused PIKACHU (base)", async () => {
await game.classicMode.startBattle([SpeciesId.PIKACHU, SpeciesId.MAROWAK]); await game.classicMode.startBattle([SpeciesId.PIKACHU, SpeciesId.MAROWAK]);
@ -147,7 +147,7 @@ describe("Items - Light Ball", () => {
expect(atkValue.value / atkStat).toBe(2); expect(atkValue.value / atkStat).toBe(2);
expect(spAtkValue.value / spAtkStat).toBe(2); expect(spAtkValue.value / spAtkStat).toBe(2);
}, 20000); });
it("LIGHT_BALL held by fused PIKACHU (part)", async () => { it("LIGHT_BALL held by fused PIKACHU (part)", async () => {
await game.classicMode.startBattle([SpeciesId.MAROWAK, SpeciesId.PIKACHU]); await game.classicMode.startBattle([SpeciesId.MAROWAK, SpeciesId.PIKACHU]);
@ -186,7 +186,7 @@ describe("Items - Light Ball", () => {
expect(atkValue.value / atkStat).toBe(2); expect(atkValue.value / atkStat).toBe(2);
expect(spAtkValue.value / spAtkStat).toBe(2); expect(spAtkValue.value / spAtkStat).toBe(2);
}, 20000); });
it("LIGHT_BALL not held by PIKACHU", async () => { it("LIGHT_BALL not held by PIKACHU", async () => {
await game.classicMode.startBattle([SpeciesId.MAROWAK]); await game.classicMode.startBattle([SpeciesId.MAROWAK]);
@ -215,5 +215,5 @@ describe("Items - Light Ball", () => {
expect(atkValue.value / atkStat).toBe(1); expect(atkValue.value / atkStat).toBe(1);
expect(spAtkValue.value / spAtkStat).toBe(1); expect(spAtkValue.value / spAtkStat).toBe(1);
}, 20000); });
}); });

View File

@ -49,5 +49,5 @@ describe("Items - Lock Capsule", () => {
game.doSelectModifier(); game.doSelectModifier();
await game.phaseInterceptor.to("SelectModifierPhase"); await game.phaseInterceptor.to("SelectModifierPhase");
}, 20000); });
}); });

View File

@ -102,7 +102,7 @@ describe("Items - Metal Powder", () => {
game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.DEF, defValue); game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.DEF, defValue);
expect(defValue.value / defStat).toBe(2); expect(defValue.value / defStat).toBe(2);
}, 20000); });
it("METAL_POWDER held by fused DITTO (base)", async () => { it("METAL_POWDER held by fused DITTO (base)", async () => {
await game.classicMode.startBattle([SpeciesId.DITTO, SpeciesId.MAROWAK]); await game.classicMode.startBattle([SpeciesId.DITTO, SpeciesId.MAROWAK]);
@ -135,7 +135,7 @@ describe("Items - Metal Powder", () => {
game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.DEF, defValue); game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.DEF, defValue);
expect(defValue.value / defStat).toBe(2); expect(defValue.value / defStat).toBe(2);
}, 20000); });
it("METAL_POWDER held by fused DITTO (part)", async () => { it("METAL_POWDER held by fused DITTO (part)", async () => {
await game.classicMode.startBattle([SpeciesId.MAROWAK, SpeciesId.DITTO]); await game.classicMode.startBattle([SpeciesId.MAROWAK, SpeciesId.DITTO]);
@ -168,7 +168,7 @@ describe("Items - Metal Powder", () => {
game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.DEF, defValue); game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.DEF, defValue);
expect(defValue.value / defStat).toBe(2); expect(defValue.value / defStat).toBe(2);
}, 20000); });
it("METAL_POWDER not held by DITTO", async () => { it("METAL_POWDER not held by DITTO", async () => {
await game.classicMode.startBattle([SpeciesId.MAROWAK]); await game.classicMode.startBattle([SpeciesId.MAROWAK]);
@ -191,5 +191,5 @@ describe("Items - Metal Powder", () => {
game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.DEF, defValue); game.scene.applyModifiers(SpeciesStatBoosterModifier, true, partyMember, Stat.DEF, defValue);
expect(defValue.value / defStat).toBe(1); expect(defValue.value / defStat).toBe(1);
}, 20000); });
}); });

View File

@ -28,7 +28,7 @@ describe("Items - Scope Lens", () => {
.moveset([MoveId.POUND]) .moveset([MoveId.POUND])
.startingHeldItems([{ name: "SCOPE_LENS" }]) .startingHeldItems([{ name: "SCOPE_LENS" }])
.battleStyle("single"); .battleStyle("single");
}, 20000); });
it("should raise CRIT stage by 1", async () => { it("should raise CRIT stage by 1", async () => {
await game.classicMode.startBattle([SpeciesId.GASTLY]); await game.classicMode.startBattle([SpeciesId.GASTLY]);
@ -42,5 +42,5 @@ describe("Items - Scope Lens", () => {
await game.phaseInterceptor.to(TurnEndPhase); await game.phaseInterceptor.to(TurnEndPhase);
expect(enemyPokemon.getCritStage).toHaveReturnedWith(1); expect(enemyPokemon.getCritStage).toHaveReturnedWith(1);
}, 20000); });
}); });

View File

@ -50,7 +50,7 @@ describe("Items - Temporary Stat Stage Boosters", () => {
await game.phaseInterceptor.runFrom("EnemyCommandPhase").to(TurnEndPhase); await game.phaseInterceptor.runFrom("EnemyCommandPhase").to(TurnEndPhase);
expect(partyMember.getStatStageMultiplier).toHaveReturnedWith(1.3); expect(partyMember.getStatStageMultiplier).toHaveReturnedWith(1.3);
}, 20000); });
it("should increase existing ACC stat stage by 1 for X_ACCURACY only", async () => { it("should increase existing ACC stat stage by 1 for X_ACCURACY only", async () => {
game.override.startingModifier([{ name: "TEMP_STAT_STAGE_BOOSTER", type: Stat.ACC }]).ability(AbilityId.SIMPLE); game.override.startingModifier([{ name: "TEMP_STAT_STAGE_BOOSTER", type: Stat.ACC }]).ability(AbilityId.SIMPLE);
@ -72,7 +72,7 @@ describe("Items - Temporary Stat Stage Boosters", () => {
// ACC at +3 stat stages yields a x2 multiplier // ACC at +3 stat stages yields a x2 multiplier
expect(partyMember.getAccuracyMultiplier).toHaveReturnedWith(2); expect(partyMember.getAccuracyMultiplier).toHaveReturnedWith(2);
}, 20000); });
it("should increase existing stat stage multiplier by 3/10 for the rest of the boosters", async () => { it("should increase existing stat stage multiplier by 3/10 for the rest of the boosters", async () => {
await game.classicMode.startBattle([SpeciesId.PIKACHU]); await game.classicMode.startBattle([SpeciesId.PIKACHU]);
@ -92,7 +92,7 @@ describe("Items - Temporary Stat Stage Boosters", () => {
// ATK at +1 stat stage yields a x1.5 multiplier, add 0.3 from X_ATTACK // ATK at +1 stat stage yields a x1.5 multiplier, add 0.3 from X_ATTACK
expect(partyMember.getStatStageMultiplier).toHaveReturnedWith(1.8); expect(partyMember.getStatStageMultiplier).toHaveReturnedWith(1.8);
}, 20000); });
it("should not increase past maximum stat stage multiplier", async () => { it("should not increase past maximum stat stage multiplier", async () => {
game.override.startingModifier([ game.override.startingModifier([
@ -116,7 +116,7 @@ describe("Items - Temporary Stat Stage Boosters", () => {
expect(partyMember.getAccuracyMultiplier).toHaveReturnedWith(3); expect(partyMember.getAccuracyMultiplier).toHaveReturnedWith(3);
expect(partyMember.getStatStageMultiplier).toHaveReturnedWith(4); expect(partyMember.getStatStageMultiplier).toHaveReturnedWith(4);
}, 20000); });
it("should renew how many battles are left of existing booster when picking up new booster of same type", async () => { it("should renew how many battles are left of existing booster when picking up new booster of same type", async () => {
game.override.startingLevel(200).itemRewards([{ name: "TEMP_STAT_STAGE_BOOSTER", type: Stat.ATK }]); game.override.startingLevel(200).itemRewards([{ name: "TEMP_STAT_STAGE_BOOSTER", type: Stat.ATK }]);
@ -161,5 +161,5 @@ describe("Items - Temporary Stat Stage Boosters", () => {
} }
} }
expect(count).toBe(1); expect(count).toBe(1);
}, 20000); });
}); });

View File

@ -55,7 +55,7 @@ describe("Moves - Baton Pass", () => {
playerPokemon = game.scene.getPlayerPokemon()!; playerPokemon = game.scene.getPlayerPokemon()!;
expect(playerPokemon.species.speciesId).toEqual(SpeciesId.SHUCKLE); expect(playerPokemon.species.speciesId).toEqual(SpeciesId.SHUCKLE);
expect(playerPokemon.getStatStage(Stat.SPATK)).toEqual(2); expect(playerPokemon.getStatStage(Stat.SPATK)).toEqual(2);
}, 20000); });
it("passes stat stage buffs when AI uses it", async () => { it("passes stat stage buffs when AI uses it", async () => {
// arrange // arrange
@ -82,7 +82,7 @@ describe("Moves - Baton Pass", () => {
"SummonPhase", "SummonPhase",
"PostSummonPhase", "PostSummonPhase",
]); ]);
}, 20000); });
it("doesn't transfer effects that aren't transferrable", async () => { it("doesn't transfer effects that aren't transferrable", async () => {
game.override.enemyMoveset([MoveId.SALT_CURE]); game.override.enemyMoveset([MoveId.SALT_CURE]);
@ -98,7 +98,7 @@ describe("Moves - Baton Pass", () => {
await game.toNextTurn(); await game.toNextTurn();
expect(player2.findTag(t => t.tagType === BattlerTagType.SALT_CURED)).toBeUndefined(); expect(player2.findTag(t => t.tagType === BattlerTagType.SALT_CURED)).toBeUndefined();
}, 20000); });
it("doesn't allow binding effects from the user to persist", async () => { it("doesn't allow binding effects from the user to persist", async () => {
game.override.moveset([MoveId.FIRE_SPIN, MoveId.BATON_PASS]); game.override.moveset([MoveId.FIRE_SPIN, MoveId.BATON_PASS]);

View File

@ -60,7 +60,7 @@ describe("Moves - Disable", () => {
result: MoveResult.FAIL, result: MoveResult.FAIL,
}); });
expect(enemyMon.isMoveRestricted(MoveId.SPLASH)).toBe(false); expect(enemyMon.isMoveRestricted(MoveId.SPLASH)).toBe(false);
}, 20000); });
it("causes STRUGGLE if all usable moves are disabled", async () => { it("causes STRUGGLE if all usable moves are disabled", async () => {
await game.classicMode.startBattle(); await game.classicMode.startBattle();
@ -78,7 +78,7 @@ describe("Moves - Disable", () => {
expect(enemyHistory).toHaveLength(2); expect(enemyHistory).toHaveLength(2);
expect(enemyHistory[0].move).toBe(MoveId.SPLASH); expect(enemyHistory[0].move).toBe(MoveId.SPLASH);
expect(enemyHistory[1].move).toBe(MoveId.STRUGGLE); expect(enemyHistory[1].move).toBe(MoveId.STRUGGLE);
}, 20000); });
it("cannot disable STRUGGLE", async () => { it("cannot disable STRUGGLE", async () => {
game.override.enemyMoveset([MoveId.STRUGGLE]); game.override.enemyMoveset([MoveId.STRUGGLE]);
@ -94,7 +94,7 @@ describe("Moves - Disable", () => {
expect(playerMon.getLastXMoves()[0].result).toBe(MoveResult.FAIL); expect(playerMon.getLastXMoves()[0].result).toBe(MoveResult.FAIL);
expect(enemyMon.getLastXMoves()[0].move).toBe(MoveId.STRUGGLE); expect(enemyMon.getLastXMoves()[0].move).toBe(MoveId.STRUGGLE);
expect(enemyMon.isMoveRestricted(MoveId.STRUGGLE)).toBe(false); expect(enemyMon.isMoveRestricted(MoveId.STRUGGLE)).toBe(false);
}, 20000); });
it("interrupts target's move when target moves after", async () => { it("interrupts target's move when target moves after", async () => {
await game.classicMode.startBattle(); await game.classicMode.startBattle();
@ -116,7 +116,7 @@ describe("Moves - Disable", () => {
result: MoveResult.SUCCESS, result: MoveResult.SUCCESS,
}); });
expect(enemyHistory[1].result).toBe(MoveResult.FAIL); expect(enemyHistory[1].result).toBe(MoveResult.FAIL);
}, 20000); });
it("disables NATURE POWER, not the move invoked by it", async () => { it("disables NATURE POWER, not the move invoked by it", async () => {
game.override.enemyMoveset([MoveId.NATURE_POWER]); game.override.enemyMoveset([MoveId.NATURE_POWER]);
@ -130,7 +130,7 @@ describe("Moves - Disable", () => {
expect(enemyMon.isMoveRestricted(MoveId.NATURE_POWER)).toBe(true); expect(enemyMon.isMoveRestricted(MoveId.NATURE_POWER)).toBe(true);
expect(enemyMon.isMoveRestricted(enemyMon.getLastXMoves(2)[0].move)).toBe(false); expect(enemyMon.isMoveRestricted(enemyMon.getLastXMoves(2)[0].move)).toBe(false);
}, 20000); });
it("disables most recent move", async () => { it("disables most recent move", async () => {
game.override.enemyMoveset([MoveId.SPLASH, MoveId.TACKLE]); game.override.enemyMoveset([MoveId.SPLASH, MoveId.TACKLE]);
@ -150,5 +150,5 @@ describe("Moves - Disable", () => {
expect(enemyMon.isMoveRestricted(MoveId.TACKLE)).toBe(true); expect(enemyMon.isMoveRestricted(MoveId.TACKLE)).toBe(true);
expect(enemyMon.isMoveRestricted(MoveId.SPLASH)).toBe(false); expect(enemyMon.isMoveRestricted(MoveId.SPLASH)).toBe(false);
}, 20000); });
}); });

View File

@ -51,7 +51,7 @@ describe("Moves - Dynamax Cannon", () => {
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(dynamaxCannon.id); expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(dynamaxCannon.id);
await game.phaseInterceptor.to(DamageAnimPhase, false); await game.phaseInterceptor.to(DamageAnimPhase, false);
expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(100); expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(100);
}, 20000); });
it("should return 100 power against an enemy at level cap", async () => { it("should return 100 power against an enemy at level cap", async () => {
game.override.enemyLevel(10); game.override.enemyLevel(10);
@ -63,7 +63,7 @@ describe("Moves - Dynamax Cannon", () => {
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(dynamaxCannon.id); expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(dynamaxCannon.id);
await game.phaseInterceptor.to(DamageAnimPhase, false); await game.phaseInterceptor.to(DamageAnimPhase, false);
expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(100); expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(100);
}, 20000); });
it("should return 120 power against an enemy 1% above level cap", async () => { it("should return 120 power against an enemy 1% above level cap", async () => {
game.override.enemyLevel(101); game.override.enemyLevel(101);
@ -78,7 +78,7 @@ describe("Moves - Dynamax Cannon", () => {
vi.spyOn(game.scene, "getMaxExpLevel").mockReturnValue(100); vi.spyOn(game.scene, "getMaxExpLevel").mockReturnValue(100);
await game.phaseInterceptor.to(DamageAnimPhase, false); await game.phaseInterceptor.to(DamageAnimPhase, false);
expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(120); expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(120);
}, 20000); });
it("should return 140 power against an enemy 2% above level capp", async () => { it("should return 140 power against an enemy 2% above level capp", async () => {
game.override.enemyLevel(102); game.override.enemyLevel(102);
@ -93,7 +93,7 @@ describe("Moves - Dynamax Cannon", () => {
vi.spyOn(game.scene, "getMaxExpLevel").mockReturnValue(100); vi.spyOn(game.scene, "getMaxExpLevel").mockReturnValue(100);
await game.phaseInterceptor.to(DamageAnimPhase, false); await game.phaseInterceptor.to(DamageAnimPhase, false);
expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(140); expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(140);
}, 20000); });
it("should return 160 power against an enemy 3% above level cap", async () => { it("should return 160 power against an enemy 3% above level cap", async () => {
game.override.enemyLevel(103); game.override.enemyLevel(103);
@ -108,7 +108,7 @@ describe("Moves - Dynamax Cannon", () => {
vi.spyOn(game.scene, "getMaxExpLevel").mockReturnValue(100); vi.spyOn(game.scene, "getMaxExpLevel").mockReturnValue(100);
await game.phaseInterceptor.to(DamageAnimPhase, false); await game.phaseInterceptor.to(DamageAnimPhase, false);
expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(160); expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(160);
}, 20000); });
it("should return 180 power against an enemy 4% above level cap", async () => { it("should return 180 power against an enemy 4% above level cap", async () => {
game.override.enemyLevel(104); game.override.enemyLevel(104);
@ -123,7 +123,7 @@ describe("Moves - Dynamax Cannon", () => {
vi.spyOn(game.scene, "getMaxExpLevel").mockReturnValue(100); vi.spyOn(game.scene, "getMaxExpLevel").mockReturnValue(100);
await game.phaseInterceptor.to(DamageAnimPhase, false); await game.phaseInterceptor.to(DamageAnimPhase, false);
expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(180); expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(180);
}, 20000); });
it("should return 200 power against an enemy 5% above level cap", async () => { it("should return 200 power against an enemy 5% above level cap", async () => {
game.override.enemyLevel(105); game.override.enemyLevel(105);
@ -138,7 +138,7 @@ describe("Moves - Dynamax Cannon", () => {
vi.spyOn(game.scene, "getMaxExpLevel").mockReturnValue(100); vi.spyOn(game.scene, "getMaxExpLevel").mockReturnValue(100);
await game.phaseInterceptor.to(DamageAnimPhase, false); await game.phaseInterceptor.to(DamageAnimPhase, false);
expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(200); expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(200);
}, 20000); });
it("should return 200 power against an enemy way above level cap", async () => { it("should return 200 power against an enemy way above level cap", async () => {
game.override.enemyLevel(999); game.override.enemyLevel(999);
@ -151,5 +151,5 @@ describe("Moves - Dynamax Cannon", () => {
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(dynamaxCannon.id); expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(dynamaxCannon.id);
await game.phaseInterceptor.to(DamageAnimPhase, false); await game.phaseInterceptor.to(DamageAnimPhase, false);
expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(200); expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(200);
}, 20000); });
}); });

View File

@ -45,5 +45,5 @@ describe("Moves - Fusion Bolt", () => {
await game.toNextTurn(); await game.toNextTurn();
expect(initialHp - partyMember.hp).toBe(0); expect(initialHp - partyMember.hp).toBe(0);
}, 20000); });
}); });

View File

@ -64,7 +64,7 @@ describe("Moves - Fusion Flare and Fusion Bolt", () => {
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionBolt.id); expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionBolt.id);
await game.phaseInterceptor.to(DamageAnimPhase, false); await game.phaseInterceptor.to(DamageAnimPhase, false);
expect(fusionBolt.calculateBattlePower).toHaveLastReturnedWith(200); expect(fusionBolt.calculateBattlePower).toHaveLastReturnedWith(200);
}, 20000); });
it("FUSION_BOLT should double power of subsequent FUSION_FLARE", async () => { it("FUSION_BOLT should double power of subsequent FUSION_FLARE", async () => {
await game.classicMode.startBattle([SpeciesId.ZEKROM, SpeciesId.ZEKROM]); await game.classicMode.startBattle([SpeciesId.ZEKROM, SpeciesId.ZEKROM]);
@ -84,7 +84,7 @@ describe("Moves - Fusion Flare and Fusion Bolt", () => {
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionFlare.id); expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionFlare.id);
await game.phaseInterceptor.to(DamageAnimPhase, false); await game.phaseInterceptor.to(DamageAnimPhase, false);
expect(fusionFlare.calculateBattlePower).toHaveLastReturnedWith(200); expect(fusionFlare.calculateBattlePower).toHaveLastReturnedWith(200);
}, 20000); });
it("FUSION_FLARE should double power of subsequent FUSION_BOLT if a move failed in between", async () => { it("FUSION_FLARE should double power of subsequent FUSION_BOLT if a move failed in between", async () => {
await game.classicMode.startBattle([SpeciesId.ZEKROM, SpeciesId.ZEKROM]); await game.classicMode.startBattle([SpeciesId.ZEKROM, SpeciesId.ZEKROM]);
@ -109,7 +109,7 @@ describe("Moves - Fusion Flare and Fusion Bolt", () => {
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionBolt.id); expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionBolt.id);
await game.phaseInterceptor.to(DamageAnimPhase, false); await game.phaseInterceptor.to(DamageAnimPhase, false);
expect(fusionBolt.calculateBattlePower).toHaveLastReturnedWith(200); expect(fusionBolt.calculateBattlePower).toHaveLastReturnedWith(200);
}, 20000); });
it("FUSION_FLARE should not double power of subsequent FUSION_BOLT if a move succeeded in between", async () => { it("FUSION_FLARE should not double power of subsequent FUSION_BOLT if a move succeeded in between", async () => {
game.override.enemyMoveset(MoveId.SPLASH); game.override.enemyMoveset(MoveId.SPLASH);
@ -134,7 +134,7 @@ describe("Moves - Fusion Flare and Fusion Bolt", () => {
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionBolt.id); expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionBolt.id);
await game.phaseInterceptor.to(DamageAnimPhase, false); await game.phaseInterceptor.to(DamageAnimPhase, false);
expect(fusionBolt.calculateBattlePower).toHaveLastReturnedWith(100); expect(fusionBolt.calculateBattlePower).toHaveLastReturnedWith(100);
}, 20000); });
it("FUSION_FLARE should double power of subsequent FUSION_BOLT if moves are aimed at allies", async () => { it("FUSION_FLARE should double power of subsequent FUSION_BOLT if moves are aimed at allies", async () => {
await game.classicMode.startBattle([SpeciesId.ZEKROM, SpeciesId.RESHIRAM]); await game.classicMode.startBattle([SpeciesId.ZEKROM, SpeciesId.RESHIRAM]);
@ -154,7 +154,7 @@ describe("Moves - Fusion Flare and Fusion Bolt", () => {
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionFlare.id); expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionFlare.id);
await game.phaseInterceptor.to(DamageAnimPhase, false); await game.phaseInterceptor.to(DamageAnimPhase, false);
expect(fusionFlare.calculateBattlePower).toHaveLastReturnedWith(200); expect(fusionFlare.calculateBattlePower).toHaveLastReturnedWith(200);
}, 20000); });
it("FUSION_FLARE and FUSION_BOLT alternating throughout turn should double power of subsequent moves", async () => { it("FUSION_FLARE and FUSION_BOLT alternating throughout turn should double power of subsequent moves", async () => {
game.override.enemyMoveset(fusionFlare.id); game.override.enemyMoveset(fusionFlare.id);
@ -208,7 +208,7 @@ describe("Moves - Fusion Flare and Fusion Bolt", () => {
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionFlare.id); expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionFlare.id);
await game.phaseInterceptor.to(DamageAnimPhase, false); await game.phaseInterceptor.to(DamageAnimPhase, false);
expect(fusionFlare.calculateBattlePower).toHaveLastReturnedWith(200); expect(fusionFlare.calculateBattlePower).toHaveLastReturnedWith(200);
}, 20000); });
it("FUSION_FLARE and FUSION_BOLT alternating throughout turn should double power of subsequent moves if moves are aimed at allies", async () => { it("FUSION_FLARE and FUSION_BOLT alternating throughout turn should double power of subsequent moves if moves are aimed at allies", async () => {
game.override.enemyMoveset(fusionFlare.id); game.override.enemyMoveset(fusionFlare.id);
@ -262,5 +262,5 @@ describe("Moves - Fusion Flare and Fusion Bolt", () => {
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionFlare.id); expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionFlare.id);
await game.phaseInterceptor.to(DamageAnimPhase, false); await game.phaseInterceptor.to(DamageAnimPhase, false);
expect(fusionFlare.calculateBattlePower).toHaveLastReturnedWith(200); expect(fusionFlare.calculateBattlePower).toHaveLastReturnedWith(200);
}, 20000); });
}); });

View File

@ -52,7 +52,7 @@ describe("Moves - Gigaton Hammer", () => {
const enemy2 = game.scene.getEnemyPokemon()!; const enemy2 = game.scene.getEnemyPokemon()!;
expect(enemy2.hp).toBe(enemy2.getMaxHp()); expect(enemy2.hp).toBe(enemy2.getMaxHp());
}, 20000); });
it("can be used again if recalled and sent back out", async () => { it("can be used again if recalled and sent back out", async () => {
game.override.startingWave(4); game.override.startingWave(4);
@ -75,5 +75,5 @@ describe("Moves - Gigaton Hammer", () => {
const enemy2 = game.scene.getEnemyPokemon()!; const enemy2 = game.scene.getEnemyPokemon()!;
expect(enemy2.hp).toBeLessThan(enemy2.getMaxHp()); expect(enemy2.hp).toBeLessThan(enemy2.getMaxHp());
}, 20000); });
}); });

View File

@ -43,5 +43,5 @@ describe("Moves - Growth", () => {
await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(TurnInitPhase); await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(TurnInitPhase);
expect(playerPokemon.getStatStage(Stat.SPATK)).toBe(1); expect(playerPokemon.getStatStage(Stat.SPATK)).toBe(1);
}, 20000); });
}); });

View File

@ -50,7 +50,7 @@ describe("Moves - Guard Split", () => {
expect(player.getStat(Stat.SPDEF, false)).toBe(avgSpDef); expect(player.getStat(Stat.SPDEF, false)).toBe(avgSpDef);
expect(enemy.getStat(Stat.SPDEF, false)).toBe(avgSpDef); expect(enemy.getStat(Stat.SPDEF, false)).toBe(avgSpDef);
}, 20000); });
it("should be idempotent", async () => { it("should be idempotent", async () => {
game.override.enemyMoveset([MoveId.GUARD_SPLIT]); game.override.enemyMoveset([MoveId.GUARD_SPLIT]);
@ -73,5 +73,5 @@ describe("Moves - Guard Split", () => {
expect(player.getStat(Stat.SPDEF, false)).toBe(avgSpDef); expect(player.getStat(Stat.SPDEF, false)).toBe(avgSpDef);
expect(enemy.getStat(Stat.SPDEF, false)).toBe(avgSpDef); expect(enemy.getStat(Stat.SPDEF, false)).toBe(avgSpDef);
}, 20000); });
}); });

View File

@ -42,7 +42,7 @@ describe("Moves - Magnet Rise", () => {
const finalHp = game.scene.getPlayerParty()[0].hp; const finalHp = game.scene.getPlayerParty()[0].hp;
const hpLost = finalHp - startingHp; const hpLost = finalHp - startingHp;
expect(hpLost).toBe(0); expect(hpLost).toBe(0);
}, 20000); });
it("MAGNET RISE - Gravity", async () => { it("MAGNET RISE - Gravity", async () => {
await game.classicMode.startBattle(); await game.classicMode.startBattle();
@ -58,5 +58,5 @@ describe("Moves - Magnet Rise", () => {
finalHp = game.scene.getPlayerParty()[0].hp; finalHp = game.scene.getPlayerParty()[0].hp;
hpLost = finalHp - startingHp; hpLost = finalHp - startingHp;
expect(hpLost).not.toBe(0); expect(hpLost).not.toBe(0);
}, 20000); });
}); });

View File

@ -50,7 +50,7 @@ describe("Moves - Power Split", () => {
expect(player.getStat(Stat.SPATK, false)).toBe(avgSpAtk); expect(player.getStat(Stat.SPATK, false)).toBe(avgSpAtk);
expect(enemy.getStat(Stat.SPATK, false)).toBe(avgSpAtk); expect(enemy.getStat(Stat.SPATK, false)).toBe(avgSpAtk);
}, 20000); });
it("should be idempotent", async () => { it("should be idempotent", async () => {
game.override.enemyMoveset([MoveId.POWER_SPLIT]); game.override.enemyMoveset([MoveId.POWER_SPLIT]);
@ -73,5 +73,5 @@ describe("Moves - Power Split", () => {
expect(player.getStat(Stat.SPATK, false)).toBe(avgSpAtk); expect(player.getStat(Stat.SPATK, false)).toBe(avgSpAtk);
expect(enemy.getStat(Stat.SPATK, false)).toBe(avgSpAtk); expect(enemy.getStat(Stat.SPATK, false)).toBe(avgSpAtk);
}, 20000); });
}); });

View File

@ -47,5 +47,5 @@ describe("Moves - Speed Swap", () => {
expect(player.getStat(Stat.SPD, false)).toBe(enemySpd); expect(player.getStat(Stat.SPD, false)).toBe(enemySpd);
expect(enemy.getStat(Stat.SPD, false)).toBe(playerSpd); expect(enemy.getStat(Stat.SPD, false)).toBe(playerSpd);
}, 20000); });
}); });

View File

@ -49,7 +49,7 @@ describe("Moves - Spikes", () => {
const player = game.scene.getPlayerParty()[0]; const player = game.scene.getPlayerParty()[0];
expect(player.hp).toBe(player.getMaxHp()); expect(player.hp).toBe(player.getMaxHp());
}, 20000); });
it("should damage opposing pokemon that are forced to switch in", async () => { it("should damage opposing pokemon that are forced to switch in", async () => {
game.override.startingWave(5); game.override.startingWave(5);
@ -63,7 +63,7 @@ describe("Moves - Spikes", () => {
const enemy = game.scene.getEnemyParty()[0]; const enemy = game.scene.getEnemyParty()[0];
expect(enemy.hp).toBeLessThan(enemy.getMaxHp()); expect(enemy.hp).toBeLessThan(enemy.getMaxHp());
}, 20000); });
it("should damage opposing pokemon that choose to switch in", async () => { it("should damage opposing pokemon that choose to switch in", async () => {
game.override.startingWave(5); game.override.startingWave(5);
@ -78,7 +78,7 @@ describe("Moves - Spikes", () => {
const enemy = game.scene.getEnemyParty()[0]; const enemy = game.scene.getEnemyParty()[0];
expect(enemy.hp).toBeLessThan(enemy.getMaxHp()); expect(enemy.hp).toBeLessThan(enemy.getMaxHp());
}, 20000); });
it("should work when all targets fainted", async () => { it("should work when all targets fainted", async () => {
game.override.enemySpecies(SpeciesId.DIGLETT).battleStyle("double").startingLevel(50); game.override.enemySpecies(SpeciesId.DIGLETT).battleStyle("double").startingLevel(50);
@ -89,5 +89,5 @@ describe("Moves - Spikes", () => {
await game.phaseInterceptor.to("TurnEndPhase"); await game.phaseInterceptor.to("TurnEndPhase");
expect(game.scene.arena.getTagOnSide(ArenaTrapTag, ArenaTagSide.ENEMY)).toBeDefined(); expect(game.scene.arena.getTagOnSide(ArenaTrapTag, ArenaTagSide.ENEMY)).toBeDefined();
}, 20000); });
}); });

View File

@ -43,8 +43,6 @@ describe("Moves - Struggle", () => {
await game.phaseInterceptor.to("BerryPhase"); await game.phaseInterceptor.to("BerryPhase");
expect(stabSpy).toHaveReturnedWith(1); expect(stabSpy).toHaveReturnedWith(1);
stabSpy.mockRestore();
}); });
it("should ignore type effectiveness", async () => { it("should ignore type effectiveness", async () => {
@ -55,11 +53,8 @@ describe("Moves - Struggle", () => {
game.move.select(MoveId.STRUGGLE); game.move.select(MoveId.STRUGGLE);
const moveEffectivenessSpy = vi.spyOn(enemy, "getMoveEffectiveness"); const moveEffectivenessSpy = vi.spyOn(enemy, "getMoveEffectiveness");
await game.phaseInterceptor.to("BerryPhase"); await game.phaseInterceptor.to("BerryPhase");
expect(moveEffectivenessSpy).toHaveReturnedWith(1); expect(moveEffectivenessSpy).toHaveReturnedWith(1);
moveEffectivenessSpy.mockRestore();
}); });
}); });

View File

@ -44,7 +44,7 @@ describe("Moves - Tackle", () => {
await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(TurnEndPhase); await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(TurnEndPhase);
const hpLost = hpOpponent - game.scene.currentBattle.enemyParty[0].hp; const hpLost = hpOpponent - game.scene.currentBattle.enemyParty[0].hp;
expect(hpLost).toBe(0); expect(hpLost).toBe(0);
}, 20000); });
it("TACKLE against not resistant", async () => { it("TACKLE against not resistant", async () => {
const moveToUse = MoveId.TACKLE; const moveToUse = MoveId.TACKLE;
@ -59,5 +59,5 @@ describe("Moves - Tackle", () => {
const hpLost = hpOpponent - game.scene.currentBattle.enemyParty[0].hp; const hpLost = hpOpponent - game.scene.currentBattle.enemyParty[0].hp;
expect(hpLost).toBeGreaterThan(0); expect(hpLost).toBeGreaterThan(0);
expect(hpLost).toBeLessThan(4); expect(hpLost).toBeLessThan(4);
}, 20000); });
}); });

View File

@ -46,5 +46,5 @@ describe("Moves - Tail whip", () => {
await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(TurnInitPhase); await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(TurnInitPhase);
expect(enemyPokemon.getStatStage(Stat.DEF)).toBe(-1); expect(enemyPokemon.getStatStage(Stat.DEF)).toBe(-1);
}, 20000); });
}); });

View File

@ -62,7 +62,7 @@ describe("Moves - Tera Blast", () => {
await game.phaseInterceptor.to("MoveEffectPhase"); await game.phaseInterceptor.to("MoveEffectPhase");
expect(spy).toHaveReturnedWith(2); expect(spy).toHaveReturnedWith(2);
}, 20000); });
it("increases power if user is Stellar tera type", async () => { it("increases power if user is Stellar tera type", async () => {
await game.classicMode.startBattle(); await game.classicMode.startBattle();

View File

@ -46,7 +46,7 @@ describe("Moves - Tidy Up", () => {
game.move.select(MoveId.TIDY_UP); game.move.select(MoveId.TIDY_UP);
await game.phaseInterceptor.to(MoveEndPhase); await game.phaseInterceptor.to(MoveEndPhase);
expect(game.scene.arena.getTag(ArenaTagType.SPIKES)).toBeUndefined(); expect(game.scene.arena.getTag(ArenaTagType.SPIKES)).toBeUndefined();
}, 20000); });
it("stealth rocks are cleared", async () => { it("stealth rocks are cleared", async () => {
game.override.moveset([MoveId.STEALTH_ROCK, MoveId.TIDY_UP]).enemyMoveset(MoveId.STEALTH_ROCK); game.override.moveset([MoveId.STEALTH_ROCK, MoveId.TIDY_UP]).enemyMoveset(MoveId.STEALTH_ROCK);
@ -57,7 +57,7 @@ describe("Moves - Tidy Up", () => {
game.move.select(MoveId.TIDY_UP); game.move.select(MoveId.TIDY_UP);
await game.phaseInterceptor.to(MoveEndPhase); await game.phaseInterceptor.to(MoveEndPhase);
expect(game.scene.arena.getTag(ArenaTagType.STEALTH_ROCK)).toBeUndefined(); expect(game.scene.arena.getTag(ArenaTagType.STEALTH_ROCK)).toBeUndefined();
}, 20000); });
it("toxic spikes are cleared", async () => { it("toxic spikes are cleared", async () => {
game.override.moveset([MoveId.TOXIC_SPIKES, MoveId.TIDY_UP]).enemyMoveset(MoveId.TOXIC_SPIKES); game.override.moveset([MoveId.TOXIC_SPIKES, MoveId.TIDY_UP]).enemyMoveset(MoveId.TOXIC_SPIKES);
@ -68,7 +68,7 @@ describe("Moves - Tidy Up", () => {
game.move.select(MoveId.TIDY_UP); game.move.select(MoveId.TIDY_UP);
await game.phaseInterceptor.to(MoveEndPhase); await game.phaseInterceptor.to(MoveEndPhase);
expect(game.scene.arena.getTag(ArenaTagType.TOXIC_SPIKES)).toBeUndefined(); expect(game.scene.arena.getTag(ArenaTagType.TOXIC_SPIKES)).toBeUndefined();
}, 20000); });
it("sticky webs are cleared", async () => { it("sticky webs are cleared", async () => {
game.override.moveset([MoveId.STICKY_WEB, MoveId.TIDY_UP]).enemyMoveset(MoveId.STICKY_WEB); game.override.moveset([MoveId.STICKY_WEB, MoveId.TIDY_UP]).enemyMoveset(MoveId.STICKY_WEB);
@ -80,7 +80,7 @@ describe("Moves - Tidy Up", () => {
game.move.select(MoveId.TIDY_UP); game.move.select(MoveId.TIDY_UP);
await game.phaseInterceptor.to(MoveEndPhase); await game.phaseInterceptor.to(MoveEndPhase);
expect(game.scene.arena.getTag(ArenaTagType.STICKY_WEB)).toBeUndefined(); expect(game.scene.arena.getTag(ArenaTagType.STICKY_WEB)).toBeUndefined();
}, 20000); });
it("substitutes are cleared", async () => { it("substitutes are cleared", async () => {
game.override.moveset([MoveId.SUBSTITUTE, MoveId.TIDY_UP]).enemyMoveset(MoveId.SUBSTITUTE); game.override.moveset([MoveId.SUBSTITUTE, MoveId.TIDY_UP]).enemyMoveset(MoveId.SUBSTITUTE);
@ -97,7 +97,7 @@ describe("Moves - Tidy Up", () => {
expect(p).toBeDefined(); expect(p).toBeDefined();
expect(p!.getTag(SubstituteTag)).toBeUndefined(); expect(p!.getTag(SubstituteTag)).toBeUndefined();
}); });
}, 20000); });
it("user's stats are raised with no traps set", async () => { it("user's stats are raised with no traps set", async () => {
await game.classicMode.startBattle(); await game.classicMode.startBattle();
@ -112,5 +112,5 @@ describe("Moves - Tidy Up", () => {
expect(playerPokemon.getStatStage(Stat.ATK)).toBe(1); expect(playerPokemon.getStatStage(Stat.ATK)).toBe(1);
expect(playerPokemon.getStatStage(Stat.SPD)).toBe(1); expect(playerPokemon.getStatStage(Stat.SPD)).toBe(1);
}, 20000); });
}); });

View File

@ -50,7 +50,7 @@ describe("Moves - U-turn", () => {
); );
expect(game.phaseInterceptor.log).toContain("SwitchSummonPhase"); expect(game.phaseInterceptor.log).toContain("SwitchSummonPhase");
expect(game.scene.getPlayerPokemon()!.species.speciesId).toBe(SpeciesId.SHUCKLE); expect(game.scene.getPlayerPokemon()!.species.speciesId).toBe(SpeciesId.SHUCKLE);
}, 20000); });
it("triggers rough skin on the u-turn user before a new pokemon is switched in", async () => { it("triggers rough skin on the u-turn user before a new pokemon is switched in", async () => {
// arrange // arrange
@ -68,7 +68,7 @@ describe("Moves - U-turn", () => {
expect(game.scene.getEnemyPokemon()!.waveData.abilityRevealed).toBe(true); // proxy for asserting ability activated expect(game.scene.getEnemyPokemon()!.waveData.abilityRevealed).toBe(true); // proxy for asserting ability activated
expect(playerPkm.species.speciesId).toEqual(SpeciesId.RAICHU); expect(playerPkm.species.speciesId).toEqual(SpeciesId.RAICHU);
expect(game.phaseInterceptor.log).not.toContain("SwitchSummonPhase"); expect(game.phaseInterceptor.log).not.toContain("SwitchSummonPhase");
}, 20000); });
it("triggers contact abilities on the u-turn user (eg poison point) before a new pokemon is switched in", async () => { it("triggers contact abilities on the u-turn user (eg poison point) before a new pokemon is switched in", async () => {
// arrange // arrange
@ -86,7 +86,7 @@ describe("Moves - U-turn", () => {
expect(playerPkm.species.speciesId).toEqual(SpeciesId.RAICHU); expect(playerPkm.species.speciesId).toEqual(SpeciesId.RAICHU);
expect(game.scene.getEnemyPokemon()!.waveData.abilityRevealed).toBe(true); // proxy for asserting ability activated expect(game.scene.getEnemyPokemon()!.waveData.abilityRevealed).toBe(true); // proxy for asserting ability activated
expect(game.phaseInterceptor.log).not.toContain("SwitchSummonPhase"); expect(game.phaseInterceptor.log).not.toContain("SwitchSummonPhase");
}, 20000); });
it("still forces a switch if u-turn KO's the opponent", async () => { it("still forces a switch if u-turn KO's the opponent", async () => {
game.override.startingLevel(1000); // Ensure that U-Turn KO's the opponent game.override.startingLevel(1000); // Ensure that U-Turn KO's the opponent

View File

@ -55,8 +55,6 @@ describe("A Trainer's Test - Mystery Encounter", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
}); });
it("should have the correct properties", async () => { it("should have the correct properties", async () => {

View File

@ -54,8 +54,6 @@ describe("Absolute Avarice - Mystery Encounter", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
}); });
it("should have the correct properties", async () => { it("should have the correct properties", async () => {

View File

@ -56,8 +56,6 @@ describe("An Offer You Can't Refuse - Mystery Encounter", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
}); });
it("should have the correct properties", async () => { it("should have the correct properties", async () => {

View File

@ -57,8 +57,6 @@ describe("Berries Abound - Mystery Encounter", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
}); });
it("should have the correct properties", async () => { it("should have the correct properties", async () => {

View File

@ -167,8 +167,6 @@ describe("Bug-Type Superfan - Mystery Encounter", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
}); });
it("should have the correct properties", async () => { it("should have the correct properties", async () => {

View File

@ -68,8 +68,6 @@ describe("Clowning Around - Mystery Encounter", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
}); });
it("should have the correct properties", async () => { it("should have the correct properties", async () => {

View File

@ -57,8 +57,6 @@ describe("Dancing Lessons - Mystery Encounter", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
}); });
it("should have the correct properties", async () => { it("should have the correct properties", async () => {

View File

@ -59,8 +59,6 @@ describe("Delibird-y - Mystery Encounter", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
}); });
it("should have the correct properties", async () => { it("should have the correct properties", async () => {

View File

@ -49,8 +49,6 @@ describe("Department Store Sale - Mystery Encounter", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
}); });
it("should have the correct properties", async () => { it("should have the correct properties", async () => {

View File

@ -47,8 +47,6 @@ describe("Field Trip - Mystery Encounter", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
}); });
it("should have the correct properties", async () => { it("should have the correct properties", async () => {

View File

@ -66,8 +66,6 @@ describe("Fiery Fallout - Mystery Encounter", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
}); });
it("should have the correct properties", async () => { it("should have the correct properties", async () => {

View File

@ -53,8 +53,6 @@ describe("Fight or Flight - Mystery Encounter", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
}); });
it("should have the correct properties", async () => { it("should have the correct properties", async () => {

View File

@ -59,8 +59,6 @@ describe("Fun And Games! - Mystery Encounter", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
}); });
it("should have the correct properties", async () => { it("should have the correct properties", async () => {

View File

@ -54,8 +54,6 @@ describe("Global Trade System - Mystery Encounter", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
}); });
it("should have the correct properties", async () => { it("should have the correct properties", async () => {

View File

@ -50,8 +50,6 @@ describe("Lost at Sea - Mystery Encounter", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
}); });
it("should have the correct properties", async () => { it("should have the correct properties", async () => {

View File

@ -60,8 +60,6 @@ describe("Mysterious Challengers - Mystery Encounter", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
}); });
it("should have the correct properties", async () => { it("should have the correct properties", async () => {

View File

@ -53,8 +53,6 @@ describe("Part-Timer - Mystery Encounter", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
}); });
it("should have the correct properties", async () => { it("should have the correct properties", async () => {

View File

@ -55,8 +55,6 @@ describe("Safari Zone - Mystery Encounter", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
}); });
it("should have the correct properties", async () => { it("should have the correct properties", async () => {

View File

@ -64,8 +64,6 @@ describe("Teleporting Hijinks - Mystery Encounter", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
}); });
it("should have the correct properties", async () => { it("should have the correct properties", async () => {

View File

@ -57,8 +57,6 @@ describe("The Expert Pokémon Breeder - Mystery Encounter", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
}); });
it("should have the correct properties", async () => { it("should have the correct properties", async () => {

View File

@ -55,8 +55,6 @@ describe("The Pokemon Salesman - Mystery Encounter", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
}); });
it("should have the correct properties", async () => { it("should have the correct properties", async () => {

View File

@ -65,8 +65,6 @@ describe("The Strong Stuff - Mystery Encounter", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
}); });
it("should have the correct properties", async () => { it("should have the correct properties", async () => {

View File

@ -61,8 +61,6 @@ describe("The Winstrate Challenge - Mystery Encounter", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
}); });
it("should have the correct properties", async () => { it("should have the correct properties", async () => {
@ -307,7 +305,7 @@ describe("The Winstrate Challenge - Mystery Encounter", () => {
) as ModifierSelectUiHandler; ) as ModifierSelectUiHandler;
expect(modifierSelectHandler.options.length).toEqual(1); expect(modifierSelectHandler.options.length).toEqual(1);
expect(modifierSelectHandler.options[0].modifierTypeOption.type.id).toBe("MYSTERY_ENCOUNTER_MACHO_BRACE"); expect(modifierSelectHandler.options[0].modifierTypeOption.type.id).toBe("MYSTERY_ENCOUNTER_MACHO_BRACE");
}, 15000); });
}); });
describe("Option 2 - Refuse the Challenge", () => { describe("Option 2 - Refuse the Challenge", () => {

View File

@ -64,8 +64,6 @@ describe("Trash to Treasure - Mystery Encounter", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
}); });
it("should have the correct properties", async () => { it("should have the correct properties", async () => {

View File

@ -62,8 +62,6 @@ describe("Uncommon Breed - Mystery Encounter", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
}); });
it("should have the correct properties", async () => { it("should have the correct properties", async () => {

View File

@ -54,8 +54,6 @@ describe("Weird Dream - Mystery Encounter", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
vi.resetAllMocks();
}); });
it("should have the correct properties", async () => { it("should have the correct properties", async () => {

View File

@ -51,6 +51,6 @@ describe("Phases", () => {
scene.phaseManager.unshiftPhase(unavailablePhase); scene.phaseManager.unshiftPhase(unavailablePhase);
await game.phaseInterceptor.to(UnavailablePhase); await game.phaseInterceptor.to(UnavailablePhase);
expect(scene.ui.getMode()).to.equal(UiMode.UNAVAILABLE); expect(scene.ui.getMode()).to.equal(UiMode.UNAVAILABLE);
}, 20000); });
}); });
}); });

View File

@ -42,8 +42,6 @@ describe("SelectModifierPhase", () => {
afterEach(() => { afterEach(() => {
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
vi.clearAllMocks();
}); });
it("should start a select modifier phase", async () => { it("should start a select modifier phase", async () => {

View File

@ -43,7 +43,7 @@ describe("Reload", () => {
const postReloadRngState = Phaser.Math.RND.state(); const postReloadRngState = Phaser.Math.RND.state();
expect(preReloadRngState).toBe(postReloadRngState); expect(preReloadRngState).toBe(postReloadRngState);
}, 20000); });
it("should not have RNG inconsistencies after a biome switch", async () => { it("should not have RNG inconsistencies after a biome switch", async () => {
game.override game.override
@ -75,7 +75,7 @@ describe("Reload", () => {
const postReloadRngState = Phaser.Math.RND.state(); const postReloadRngState = Phaser.Math.RND.state();
expect(preReloadRngState).toBe(postReloadRngState); expect(preReloadRngState).toBe(postReloadRngState);
}, 20000); });
it("should not have weather inconsistencies after a biome switch", async () => { it("should not have weather inconsistencies after a biome switch", async () => {
game.override game.override
@ -101,7 +101,7 @@ describe("Reload", () => {
const postReloadWeather = game.scene.arena.weather; const postReloadWeather = game.scene.arena.weather;
expect(postReloadWeather).toStrictEqual(preReloadWeather); expect(postReloadWeather).toStrictEqual(preReloadWeather);
}, 20000); });
it("should not have RNG inconsistencies at a Daily run wild Pokemon fight", async () => { it("should not have RNG inconsistencies at a Daily run wild Pokemon fight", async () => {
await game.dailyMode.startBattle(); await game.dailyMode.startBattle();
@ -113,7 +113,7 @@ describe("Reload", () => {
const postReloadRngState = Phaser.Math.RND.state(); const postReloadRngState = Phaser.Math.RND.state();
expect(preReloadRngState).toBe(postReloadRngState); expect(preReloadRngState).toBe(postReloadRngState);
}, 20000); });
it("should not have RNG inconsistencies at a Daily run double battle", async () => { it("should not have RNG inconsistencies at a Daily run double battle", async () => {
game.override.battleStyle("double"); game.override.battleStyle("double");
@ -126,7 +126,7 @@ describe("Reload", () => {
const postReloadRngState = Phaser.Math.RND.state(); const postReloadRngState = Phaser.Math.RND.state();
expect(preReloadRngState).toBe(postReloadRngState); expect(preReloadRngState).toBe(postReloadRngState);
}, 20000); });
it("should not have RNG inconsistencies at a Daily run Gym Leader fight", async () => { it("should not have RNG inconsistencies at a Daily run Gym Leader fight", async () => {
game.override.battleStyle("single").startingWave(40); game.override.battleStyle("single").startingWave(40);
@ -139,7 +139,7 @@ describe("Reload", () => {
const postReloadRngState = Phaser.Math.RND.state(); const postReloadRngState = Phaser.Math.RND.state();
expect(preReloadRngState).toBe(postReloadRngState); expect(preReloadRngState).toBe(postReloadRngState);
}, 20000); });
it("should not have RNG inconsistencies at a Daily run regular trainer fight", async () => { it("should not have RNG inconsistencies at a Daily run regular trainer fight", async () => {
game.override.battleStyle("single").startingWave(45); game.override.battleStyle("single").startingWave(45);
@ -152,7 +152,7 @@ describe("Reload", () => {
const postReloadRngState = Phaser.Math.RND.state(); const postReloadRngState = Phaser.Math.RND.state();
expect(preReloadRngState).toBe(postReloadRngState); expect(preReloadRngState).toBe(postReloadRngState);
}, 20000); });
it("should not have RNG inconsistencies at a Daily run wave 50 Boss fight", async () => { it("should not have RNG inconsistencies at a Daily run wave 50 Boss fight", async () => {
game.override.battleStyle("single").startingWave(50); game.override.battleStyle("single").startingWave(50);
@ -165,5 +165,5 @@ describe("Reload", () => {
const postReloadRngState = Phaser.Math.RND.state(); const postReloadRngState = Phaser.Math.RND.state();
expect(preReloadRngState).toBe(postReloadRngState); expect(preReloadRngState).toBe(postReloadRngState);
}, 20000); });
}); });

View File

@ -1,6 +1,6 @@
import GameManager from "#test/testUtils/gameManager"; import GameManager from "#test/testUtils/gameManager";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, type MockInstance, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import PokedexUiHandler from "#app/ui/pokedex-ui-handler"; import PokedexUiHandler from "#app/ui/pokedex-ui-handler";
import { FilterTextRow } from "#app/ui/filter-text"; import { FilterTextRow } from "#app/ui/filter-text";
import { allAbilities } from "#app/data/data-lists"; import { allAbilities } from "#app/data/data-lists";
@ -46,7 +46,6 @@ function permutations<T>(array: T[], length: number): T[][] {
describe("UI - Pokedex", () => { describe("UI - Pokedex", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
let game: GameManager; let game: GameManager;
const mocks: MockInstance[] = [];
beforeAll(() => { beforeAll(() => {
phaserGame = new Phaser.Game({ phaserGame = new Phaser.Game({
@ -55,9 +54,6 @@ describe("UI - Pokedex", () => {
}); });
afterEach(() => { afterEach(() => {
while (mocks.length > 0) {
mocks.pop()?.mockRestore();
}
game.phaseInterceptor.restoreOg(); game.phaseInterceptor.restoreOg();
}); });
@ -185,10 +181,10 @@ describe("UI - Pokedex", () => {
checks.push(...pokemon.forms); checks.push(...pokemon.forms);
} }
for (const p of checks) { for (const p of checks) {
mocks.push(vi.spyOn(p, "ability1", "get").mockReturnValue(ability)); vi.spyOn(p, "ability1", "get").mockReturnValue(ability);
mocks.push(vi.spyOn(p, "ability2", "get").mockReturnValue(ability2)); vi.spyOn(p, "ability2", "get").mockReturnValue(ability2);
mocks.push(vi.spyOn(p, "abilityHidden", "get").mockReturnValue(hidden)); vi.spyOn(p, "abilityHidden", "get").mockReturnValue(hidden);
mocks.push(vi.spyOn(p, "getPassiveAbility").mockReturnValue(passive)); vi.spyOn(p, "getPassiveAbility").mockReturnValue(passive);
} }
} }

View File

@ -94,7 +94,7 @@ describe("UI - Starter select", () => {
expect(game.scene.getPlayerParty()[0].shiny).toBe(true); expect(game.scene.getPlayerParty()[0].shiny).toBe(true);
expect(game.scene.getPlayerParty()[0].variant).toBe(2); expect(game.scene.getPlayerParty()[0].variant).toBe(2);
expect(game.scene.getPlayerParty()[0].gender).toBe(Gender.MALE); expect(game.scene.getPlayerParty()[0].gender).toBe(Gender.MALE);
}, 20000); });
it("Bulbasaur - shiny - variant 2 female hardy overgrow", async () => { it("Bulbasaur - shiny - variant 2 female hardy overgrow", async () => {
await game.importData("./test/testUtils/saves/everything.prsv"); await game.importData("./test/testUtils/saves/everything.prsv");
@ -156,7 +156,7 @@ describe("UI - Starter select", () => {
expect(game.scene.getPlayerParty()[0].variant).toBe(2); expect(game.scene.getPlayerParty()[0].variant).toBe(2);
expect(game.scene.getPlayerParty()[0].nature).toBe(Nature.HARDY); expect(game.scene.getPlayerParty()[0].nature).toBe(Nature.HARDY);
expect(game.scene.getPlayerParty()[0].getAbility().id).toBe(AbilityId.OVERGROW); expect(game.scene.getPlayerParty()[0].getAbility().id).toBe(AbilityId.OVERGROW);
}, 20000); });
it("Bulbasaur - shiny - variant 2 female lonely chlorophyl", async () => { it("Bulbasaur - shiny - variant 2 female lonely chlorophyl", async () => {
await game.importData("./test/testUtils/saves/everything.prsv"); await game.importData("./test/testUtils/saves/everything.prsv");
@ -221,7 +221,7 @@ describe("UI - Starter select", () => {
expect(game.scene.getPlayerParty()[0].gender).toBe(Gender.FEMALE); expect(game.scene.getPlayerParty()[0].gender).toBe(Gender.FEMALE);
expect(game.scene.getPlayerParty()[0].nature).toBe(Nature.LONELY); expect(game.scene.getPlayerParty()[0].nature).toBe(Nature.LONELY);
expect(game.scene.getPlayerParty()[0].getAbility().id).toBe(AbilityId.CHLOROPHYLL); expect(game.scene.getPlayerParty()[0].getAbility().id).toBe(AbilityId.CHLOROPHYLL);
}, 20000); });
it("Bulbasaur - shiny - variant 2 female", async () => { it("Bulbasaur - shiny - variant 2 female", async () => {
await game.importData("./test/testUtils/saves/everything.prsv"); await game.importData("./test/testUtils/saves/everything.prsv");
@ -282,7 +282,7 @@ describe("UI - Starter select", () => {
expect(game.scene.getPlayerParty()[0].shiny).toBe(true); expect(game.scene.getPlayerParty()[0].shiny).toBe(true);
expect(game.scene.getPlayerParty()[0].variant).toBe(2); expect(game.scene.getPlayerParty()[0].variant).toBe(2);
expect(game.scene.getPlayerParty()[0].gender).toBe(Gender.FEMALE); expect(game.scene.getPlayerParty()[0].gender).toBe(Gender.FEMALE);
}, 20000); });
it("Bulbasaur - not shiny", async () => { it("Bulbasaur - not shiny", async () => {
await game.importData("./test/testUtils/saves/everything.prsv"); await game.importData("./test/testUtils/saves/everything.prsv");
@ -342,7 +342,7 @@ describe("UI - Starter select", () => {
expect(game.scene.getPlayerParty()[0].species.speciesId).toBe(SpeciesId.BULBASAUR); expect(game.scene.getPlayerParty()[0].species.speciesId).toBe(SpeciesId.BULBASAUR);
expect(game.scene.getPlayerParty()[0].shiny).toBe(false); expect(game.scene.getPlayerParty()[0].shiny).toBe(false);
expect(game.scene.getPlayerParty()[0].variant).toBe(0); expect(game.scene.getPlayerParty()[0].variant).toBe(0);
}, 20000); });
it("Bulbasaur - shiny - variant 1", async () => { it("Bulbasaur - shiny - variant 1", async () => {
await game.importData("./test/testUtils/saves/everything.prsv"); await game.importData("./test/testUtils/saves/everything.prsv");
@ -404,7 +404,7 @@ describe("UI - Starter select", () => {
expect(game.scene.getPlayerParty()[0].species.speciesId).toBe(SpeciesId.BULBASAUR); expect(game.scene.getPlayerParty()[0].species.speciesId).toBe(SpeciesId.BULBASAUR);
expect(game.scene.getPlayerParty()[0].shiny).toBe(true); expect(game.scene.getPlayerParty()[0].shiny).toBe(true);
expect(game.scene.getPlayerParty()[0].variant).toBe(1); expect(game.scene.getPlayerParty()[0].variant).toBe(1);
}, 20000); });
it("Bulbasaur - shiny - variant 0", async () => { it("Bulbasaur - shiny - variant 0", async () => {
await game.importData("./test/testUtils/saves/everything.prsv"); await game.importData("./test/testUtils/saves/everything.prsv");
@ -465,7 +465,7 @@ describe("UI - Starter select", () => {
expect(game.scene.getPlayerParty()[0].species.speciesId).toBe(SpeciesId.BULBASAUR); expect(game.scene.getPlayerParty()[0].species.speciesId).toBe(SpeciesId.BULBASAUR);
expect(game.scene.getPlayerParty()[0].shiny).toBe(true); expect(game.scene.getPlayerParty()[0].shiny).toBe(true);
expect(game.scene.getPlayerParty()[0].variant).toBe(0); expect(game.scene.getPlayerParty()[0].variant).toBe(0);
}, 20000); });
it("Check if first pokemon in party is caterpie from gen 1 and 1rd row, 3rd column", async () => { it("Check if first pokemon in party is caterpie from gen 1 and 1rd row, 3rd column", async () => {
await game.importData("./test/testUtils/saves/everything.prsv"); await game.importData("./test/testUtils/saves/everything.prsv");
@ -529,7 +529,7 @@ describe("UI - Starter select", () => {
}); });
await game.phaseInterceptor.whenAboutToRun(EncounterPhase); await game.phaseInterceptor.whenAboutToRun(EncounterPhase);
expect(game.scene.getPlayerParty()[0].species.speciesId).toBe(SpeciesId.CATERPIE); expect(game.scene.getPlayerParty()[0].species.speciesId).toBe(SpeciesId.CATERPIE);
}, 20000); });
it("Check if first pokemon in party is nidoran_m from gen 1 and 2nd row, 4th column (cursor (9+4)-1)", async () => { it("Check if first pokemon in party is nidoran_m from gen 1 and 2nd row, 4th column (cursor (9+4)-1)", async () => {
await game.importData("./test/testUtils/saves/everything.prsv"); await game.importData("./test/testUtils/saves/everything.prsv");
@ -595,5 +595,5 @@ describe("UI - Starter select", () => {
}); });
await game.phaseInterceptor.whenAboutToRun(EncounterPhase); await game.phaseInterceptor.whenAboutToRun(EncounterPhase);
expect(game.scene.getPlayerParty()[0].species.speciesId).toBe(SpeciesId.NIDORAN_M); expect(game.scene.getPlayerParty()[0].species.speciesId).toBe(SpeciesId.NIDORAN_M);
}, 20000); });
}); });

View File

@ -77,7 +77,7 @@ describe("UI - Transfer Items", () => {
}); });
await game.phaseInterceptor.to("SelectModifierPhase"); await game.phaseInterceptor.to("SelectModifierPhase");
}, 20000); });
it("check transfer option for pokemon to transfer to", async () => { it("check transfer option for pokemon to transfer to", async () => {
game.onNextPrompt("SelectModifierPhase", UiMode.PARTY, () => { game.onNextPrompt("SelectModifierPhase", UiMode.PARTY, () => {
@ -98,5 +98,5 @@ describe("UI - Transfer Items", () => {
}); });
await game.phaseInterceptor.to("SelectModifierPhase"); await game.phaseInterceptor.to("SelectModifierPhase");
}, 20000); });
}); });