pokerogue/test/moves/alluring_voice.test.ts
NightKev d5f7665b15
[Test] Update test utils (#5848)
* [Test] Add/update test utils

- Add `FieldHelper` which has methods to mock a pokemon's ability
or force a pokemon to be Terastallized

- Add `MoveHelper#use` which can be used to remove the need
for setting pokemon move overrides by modifying the
moveset of the pokemon

- Add `MoveHelper#selectEnemyMove` to make an enemy pokemon
select a specific move

- Add `MoveHelper#forceEnemyMove` which modifies
the pokemon's moveset and then uses `selectEnemyMove`

- Fix `GameManager#toNextTurn` to work correctly in double battles

- Add `GameManager#toEndOfTurn` which advances to the end of the turn

* Update some tests

- Disable broken Good As Gold test
and add `.edgeCase` to Good As Gold

- Fix Powder test

- Update some tests to demonstrate new methods
2025-05-30 12:24:05 -07:00

50 lines
1.5 KiB
TypeScript

import { BattlerIndex } from "#app/battle";
import { Abilities } from "#app/enums/abilities";
import { BattlerTagType } from "#app/enums/battler-tag-type";
import { BerryPhase } from "#app/phases/berry-phase";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/testUtils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Moves - Alluring Voice", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
game.override
.battleStyle("single")
.disableCrits()
.enemySpecies(Species.MAGIKARP)
.enemyAbility(Abilities.ICE_SCALES)
.enemyMoveset(Moves.HOWL)
.startingLevel(10)
.enemyLevel(10)
.ability(Abilities.BALL_FETCH);
});
it("should confuse the opponent if their stat stages were raised", async () => {
await game.classicMode.startBattle([Species.FEEBAS]);
const enemy = game.scene.getEnemyPokemon()!;
game.move.use(Moves.ALLURING_VOICE);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
await game.phaseInterceptor.to(BerryPhase);
expect(enemy.getTag(BattlerTagType.CONFUSED)?.tagType).toBe("CONFUSED");
});
});