mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-27 10:42:25 +02:00
Stop creating new BattleScenes in battlerTags\substitute.test.ts
This commit is contained in:
parent
791bcf32ab
commit
b27f91390f
@ -1,22 +1,40 @@
|
|||||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
import type { PokemonTurnData, TurnMove, PokemonMove } from "#app/field/pokemon";
|
import type { PokemonTurnData, TurnMove, PokemonMove } from "#app/field/pokemon";
|
||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import { MoveResult } from "#app/field/pokemon";
|
import { MoveResult } from "#app/field/pokemon";
|
||||||
import BattleScene from "#app/battle-scene";
|
import type BattleScene from "#app/battle-scene";
|
||||||
import { BattlerTagLapseType, BindTag, SubstituteTag } from "#app/data/battler-tags";
|
import { BattlerTagLapseType, BindTag, SubstituteTag } from "#app/data/battler-tags";
|
||||||
import { Moves } from "#app/enums/moves";
|
import { Moves } from "#app/enums/moves";
|
||||||
import { PokemonAnimType } from "#app/enums/pokemon-anim-type";
|
import { PokemonAnimType } from "#app/enums/pokemon-anim-type";
|
||||||
import * as messages from "#app/messages";
|
import * as messages from "#app/messages";
|
||||||
import { allMoves } from "#app/data/move";
|
import { allMoves } from "#app/data/move";
|
||||||
import type { MoveEffectPhase } from "#app/phases/move-effect-phase";
|
import type { MoveEffectPhase } from "#app/phases/move-effect-phase";
|
||||||
|
import { GameManager } from "#test/testUtils/gameManager";
|
||||||
|
|
||||||
describe("BattlerTag - SubstituteTag", () => {
|
describe("BattlerTag - SubstituteTag", () => {
|
||||||
|
let phaserGame: Phaser.Game;
|
||||||
|
let game: GameManager;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
phaserGame = new Phaser.Game({
|
||||||
|
type: Phaser.HEADLESS,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
game.phaseInterceptor.restoreOg();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
game = new GameManager(phaserGame);
|
||||||
|
});
|
||||||
|
|
||||||
let mockPokemon: Pokemon;
|
let mockPokemon: Pokemon;
|
||||||
|
|
||||||
describe("onAdd behavior", () => {
|
describe("onAdd behavior", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mockPokemon = {
|
mockPokemon = {
|
||||||
scene: new BattleScene(),
|
scene: game.scene,
|
||||||
hp: 101,
|
hp: 101,
|
||||||
id: 0,
|
id: 0,
|
||||||
getMaxHp: vi.fn().mockReturnValue(101) as Pokemon["getMaxHp"],
|
getMaxHp: vi.fn().mockReturnValue(101) as Pokemon["getMaxHp"],
|
||||||
@ -84,7 +102,7 @@ describe("BattlerTag - SubstituteTag", () => {
|
|||||||
describe("onRemove behavior", () => {
|
describe("onRemove behavior", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mockPokemon = {
|
mockPokemon = {
|
||||||
scene: new BattleScene(),
|
scene: game.scene,
|
||||||
hp: 101,
|
hp: 101,
|
||||||
id: 0,
|
id: 0,
|
||||||
isFainted: vi.fn().mockReturnValue(false) as Pokemon["isFainted"]
|
isFainted: vi.fn().mockReturnValue(false) as Pokemon["isFainted"]
|
||||||
@ -119,7 +137,7 @@ describe("BattlerTag - SubstituteTag", () => {
|
|||||||
describe("lapse behavior", () => {
|
describe("lapse behavior", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mockPokemon = {
|
mockPokemon = {
|
||||||
scene: new BattleScene(),
|
scene: game.scene,
|
||||||
hp: 101,
|
hp: 101,
|
||||||
id: 0,
|
id: 0,
|
||||||
turnData: { acted: true } as PokemonTurnData,
|
turnData: { acted: true } as PokemonTurnData,
|
||||||
|
Loading…
Reference in New Issue
Block a user