mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-10-05 04:37:19 +02:00
* better phase management in tests * cleanup runFrom/to * first step of async error handling * second step of async error handling, halt await, still an issue with select-starter test * added back whenAboutToRun * added back full run suite for starter-select.test.ts
40 lines
1.5 KiB
TypeScript
40 lines
1.5 KiB
TypeScript
import {afterEach, beforeAll, beforeEach, describe, it, vi} from "vitest";
|
|
import GameManager from "#app/test/utils/gameManager";
|
|
import Phaser from "phaser";
|
|
import * as overrides from "#app/overrides";
|
|
import {Species} from "#app/data/enums/species";
|
|
import {Moves} from "#app/data/enums/moves";
|
|
import {Abilities} from "#app/data/enums/abilities";
|
|
|
|
describe("Test Battle Phase", () => {
|
|
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 start phase", async() => {
|
|
vi.spyOn(overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEWTWO);
|
|
vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA);
|
|
vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000);
|
|
vi.spyOn(overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(3);
|
|
vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]);
|
|
vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION);
|
|
vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]);
|
|
vi.spyOn(overrides, "SINGLE_BATTLE_OVERRIDE", "get").mockReturnValue(true);
|
|
await game.startBattle();
|
|
}, 100000);
|
|
});
|
|
|