2024-08-22 06:49:33 -07:00
|
|
|
import { LoadingScene } from "#app/loading-scene";
|
2024-09-02 22:18:18 -04:00
|
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
2025-02-22 22:52:07 -06:00
|
|
|
import GameManager from "#test/testUtils/gameManager";
|
2024-07-29 21:28:43 -07:00
|
|
|
|
|
|
|
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);
|
|
|
|
});
|
2024-09-02 22:18:18 -04:00
|
|
|
|
|
|
|
it("should also reset RNG on reset", () => {
|
|
|
|
vi.spyOn(game.scene, "resetSeed");
|
|
|
|
|
|
|
|
game.scene.reset();
|
|
|
|
|
|
|
|
expect(game.scene.resetSeed).toHaveBeenCalled();
|
|
|
|
});
|
2024-07-29 21:28:43 -07:00
|
|
|
});
|