2024-08-22 14:49:33 +01:00
|
|
|
import { LoadingScene } from "#app/loading-scene";
|
2024-09-03 03:18:18 +01:00
|
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
2024-07-30 05:28:43 +01:00
|
|
|
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);
|
|
|
|
});
|
2024-09-03 03:18:18 +01:00
|
|
|
|
|
|
|
it("should also reset RNG on reset", () => {
|
|
|
|
vi.spyOn(game.scene, "resetSeed");
|
|
|
|
|
|
|
|
game.scene.reset();
|
|
|
|
|
|
|
|
expect(game.scene.resetSeed).toHaveBeenCalled();
|
|
|
|
});
|
2024-07-30 05:28:43 +01:00
|
|
|
});
|