pokerogue/src/test/field/pokemon.test.ts
NightKev 828897316e
[Test] Replace doAttack() with move.select() in tests (#3567)
* Consolidate `doSelectTarget()` into `doAttack()`

* Fix ternary

* Add error message to aid in debugging tests

* Update docs

* [Test] Change `doAttack()` to `selectMove()`

* Add `select()` to `src/test/utils/helpers/moveHelper.ts`

* Replace instances of `game.selectMove()` with `game.move.select()`

* Fix imports

* Replace `selectMove()` with `move.select()` helper

Fix broken tests for Pastel Veil and Sweet Veil

* Update tsdocs
2024-08-22 06:49:33 -07:00

32 lines
778 B
TypeScript

import { Species } from "#app/enums/species";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import GameManager from "../utils/gameManager";
describe("Spec - Pokemon", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
});
it("should not crash when trying to set status of undefined", async () => {
await game.classicMode.runToSummon([Species.ABRA]);
const pkm = game.scene.getPlayerPokemon()!;
expect(pkm).toBeDefined();
expect(pkm.trySetStatus(undefined)).toBe(true);
});
});