pokerogue/src/test/battle-scene.test.ts
flx-sta 29aa1a68e7
[Optimization] Destroy LoadingScene when done (after beta rebase) (#3215)
* destroy loading-scene when done

- unused event listeners are shut off
- children are removed
- `loading_bg` will be removed after transition is finished
- Added some simple types for `rex` plugins

* fix tests

* fix pokemonSprite.test.ts

on local runs it would include hidden dirs like `.DS_store`. Any files starting with `.` is now excluded

* add `mockGameObjectCreator` and use in `gameWrapper`

* add battle-scene.test.ts

add test to verify that LoadingScene is being removed on `BatleScene.create()` call

* update types usage for phaser3-rex-plugins

* remove phaser-extensions.d.ts

fk you typedoc...
2024-07-30 00:28:43 -04:00

28 lines
720 B
TypeScript

import { LoadingScene } from "#app/loading-scene.js";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import GameManager from "./utils/gameManager";
describe("BattleScene", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
});
beforeEach(() => {
game = new GameManager(phaserGame);
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
it("should remove LoadingScene on create", () => {
// `BattleScene.create()` is called during the `new GameManager()` call
expect(game.scene.scene.remove).toHaveBeenCalledWith(LoadingScene.KEY);
});
});