pokerogue/src/test/battle-scene.test.ts
PigeonBar 587360c8da
[Bug] Fix eggs having exploitable RNG (#3913)
* [Bug] Fix eggs having exploitable RNG

* Fix Wind Rider test having random chance to fail

* Revert egg's ID back to its own unseeded generation

* Remove change from wind rider test

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: Mumble <171087428+frutescens@users.noreply.github.com>
2024-09-02 22:18:18 -04:00

36 lines
893 B
TypeScript

import { LoadingScene } from "#app/loading-scene";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } 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);
});
it("should also reset RNG on reset", () => {
vi.spyOn(game.scene, "resetSeed");
game.scene.reset();
expect(game.scene.resetSeed).toHaveBeenCalled();
});
});