Skip to content

Commit

Permalink
improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
torranx committed Sep 9, 2024
1 parent a82d64b commit 8071b48
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
17 changes: 8 additions & 9 deletions src/test/abilities/gorilla_tactics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("Abilities - Gorilla Tactics", () => {
.enemyMoveset([Moves.SPLASH, Moves.DISABLE])
.enemySpecies(Species.MAGIKARP)
.enemyLevel(30)
.moveset([Moves.SPLASH, Moves.TACKLE])
.moveset([Moves.SPLASH, Moves.TACKLE, Moves.GROWL])
.ability(Abilities.GORILLA_TACTICS);
});

Expand All @@ -57,22 +57,21 @@ describe("Abilities - Gorilla Tactics", () => {
const darmanitan = game.scene.getPlayerPokemon()!;
const enemy = game.scene.getEnemyPokemon()!;

game.move.select(Moves.SPLASH);

await game.phaseInterceptor.to("TurnEndPhase");
// First turn, lock move to Growl
game.move.select(Moves.GROWL);
await game.forceEnemyMove(Moves.SPLASH);

// Turn where Tackle is interrupted by Disable
// Second turn, Growl is interrupted by Disable
await game.toNextTurn();

game.move.select(Moves.SPLASH);
game.move.select(Moves.GROWL);
await game.forceEnemyMove(Moves.DISABLE);

await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);

await game.phaseInterceptor.to("TurnEndPhase");
expect(enemy.hp).toBe(enemy.getMaxHp());
expect(enemy.getStatStage(Stat.ATK)).toBe(-1); // Only the effect of the first Growl should be applied

// Turn where Struggle is used
// Third turn, Struggle is used
await game.toNextTurn();

game.move.select(Moves.TACKLE);
Expand Down
6 changes: 4 additions & 2 deletions src/test/moves/throat_chop.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ describe("Moves - Throat Chop", () => {
it("prevents the target from using sound-based moves for two turns", async () => {
await game.classicMode.startBattle([Species.MAGIKARP]);

const enemy = game.scene.getEnemyPokemon()!;

game.move.select(Moves.GROWL);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);

// First turn, move is interrupted
await game.phaseInterceptor.to("TurnEndPhase");
expect(game.scene.getPlayerPokemon()?.getStatStage(Stat.ATK)).toBe(0);
expect(enemy.getStatStage(Stat.ATK)).toBe(0);

// Second turn, struggle if no valid moves
await game.toNextTurn();
Expand All @@ -50,6 +52,6 @@ describe("Moves - Throat Chop", () => {
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);

await game.phaseInterceptor.to("MoveEndPhase");
expect(game.scene.getEnemyPokemon()!.isFullHp()).toBe(false);
expect(enemy.isFullHp()).toBe(false);
}, TIMEOUT);
});

0 comments on commit 8071b48

Please sign in to comment.