Test Cleanup

This commit is contained in:
frutescens 2024-10-07 07:42:01 -07:00
parent 43832ba7b6
commit 68ec122fdf
1 changed files with 7 additions and 4 deletions

View File

@ -3,6 +3,7 @@ import { allMoves } from "#app/data/move";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { MoveResult } from "#app/field/pokemon";
import GameManager from "#test/utils/gameManager"; import GameManager from "#test/utils/gameManager";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, it, expect, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, it, expect, vi } from "vitest";
@ -79,6 +80,7 @@ describe("Moves - Telekinesis", () => {
await game.phaseInterceptor.to("TurnEndPhase"); await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyOpponent?.getTag(BattlerTagType.TELEKINESIS)).toBeDefined(); expect(enemyOpponent?.getTag(BattlerTagType.TELEKINESIS)).toBeDefined();
expect(enemyOpponent?.getTag(BattlerTagType.FLOATING)).toBeDefined(); expect(enemyOpponent?.getTag(BattlerTagType.FLOATING)).toBeDefined();
expect(enemyOpponent?.summonData.speciesForm?.speciesId).toBe(Species.DIGLETT);
}); });
it("Moves like Smack Down and 1000 Arrows remove all effects of Telekinesis from the target Pokemon", async () => { it("Moves like Smack Down and 1000 Arrows remove all effects of Telekinesis from the target Pokemon", async () => {
@ -103,11 +105,12 @@ describe("Moves - Telekinesis", () => {
game.override.enemyMoveset([ Moves.SPLASH, Moves.INGRAIN ]); game.override.enemyMoveset([ Moves.SPLASH, Moves.INGRAIN ]);
await game.classicMode.startBattle([ Species.MAGIKARP ]); await game.classicMode.startBattle([ Species.MAGIKARP ]);
const playerPokemon = game.scene.getPlayerPokemon();
const enemyOpponent = game.scene.getEnemyPokemon(); const enemyOpponent = game.scene.getEnemyPokemon();
expect(enemyOpponent).toBeDefined(); expect(enemyOpponent).toBeDefined();
game.move.select(Moves.TELEKINESIS); game.move.select(Moves.TELEKINESIS);
game.forceEnemyMove(Moves.SPLASH); await game.forceEnemyMove(Moves.SPLASH);
await game.phaseInterceptor.to("TurnEndPhase"); await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyOpponent?.getTag(BattlerTagType.TELEKINESIS)).toBeDefined(); expect(enemyOpponent?.getTag(BattlerTagType.TELEKINESIS)).toBeDefined();
expect(enemyOpponent?.getTag(BattlerTagType.FLOATING)).toBeDefined(); expect(enemyOpponent?.getTag(BattlerTagType.FLOATING)).toBeDefined();
@ -115,13 +118,13 @@ describe("Moves - Telekinesis", () => {
await game.toNextTurn(); await game.toNextTurn();
vi.spyOn(allMoves[Moves.MUD_SHOT], "accuracy", "get").mockReturnValue(0); vi.spyOn(allMoves[Moves.MUD_SHOT], "accuracy", "get").mockReturnValue(0);
game.move.select(Moves.MUD_SHOT); game.move.select(Moves.MUD_SHOT);
game.forceEnemyMove(Moves.INGRAIN); await game.forceEnemyMove(Moves.INGRAIN);
await game.phaseInterceptor.to("TurnEndPhase"); await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyOpponent?.getTag(BattlerTagType.TELEKINESIS)).toBeDefined(); expect(enemyOpponent?.getTag(BattlerTagType.TELEKINESIS)).toBeDefined();
expect(enemyOpponent?.getTag(BattlerTagType.INGRAIN)).toBeDefined(); expect(enemyOpponent?.getTag(BattlerTagType.INGRAIN)).toBeDefined();
expect(enemyOpponent?.getTag(BattlerTagType.IGNORE_FLYING)).toBeDefined(); expect(enemyOpponent?.getTag(BattlerTagType.IGNORE_FLYING)).toBeDefined();
expect(enemyOpponent?.getTag(BattlerTagType.FLOATING)).toBeUndefined(); expect(enemyOpponent?.getTag(BattlerTagType.FLOATING)).toBeUndefined();
expect(enemyOpponent?.hp).toBeLessThan(enemyOpponent!.getMaxHp()); const lastMoveResult = playerPokemon?.getLastXMoves()[0].result;
expect(lastMoveResult).toBe(MoveResult.SUCCESS);
}); });
}); });