Fix egg tests (memory use: ~2.4G -> ~550M) (#3757)

This commit is contained in:
NightKev 2024-08-25 11:07:06 -07:00 committed by GitHub
parent 2df5da2f61
commit 72702abb2f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8,7 +8,6 @@ import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager"; import GameManager from "#test/utils/gameManager";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import BattleScene from "../../battle-scene";
describe("Egg Generation Tests", () => { describe("Egg Generation Tests", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -18,6 +17,7 @@ describe("Egg Generation Tests", () => {
phaserGame = new Phaser.Game({ phaserGame = new Phaser.Game({
type: Phaser.HEADLESS, type: Phaser.HEADLESS,
}); });
game = new GameManager(phaserGame);
}); });
afterEach(() => { afterEach(() => {
@ -26,12 +26,11 @@ describe("Egg Generation Tests", () => {
}); });
beforeEach(async () => { beforeEach(async () => {
game = new GameManager(phaserGame);
await game.importData("src/test/utils/saves/everything.prsv"); await game.importData("src/test/utils/saves/everything.prsv");
}); });
it("should return Arceus for the 10th of June", () => { it("should return Arceus for the 10th of June", () => {
const scene = new BattleScene(); const scene = game.scene;
const timestamp = new Date(2024, 5, 10, 15, 0, 0, 0).getTime(); const timestamp = new Date(2024, 5, 10, 15, 0, 0, 0).getTime();
const expectedSpecies = Species.ARCEUS; const expectedSpecies = Species.ARCEUS;
@ -40,7 +39,7 @@ describe("Egg Generation Tests", () => {
expect(result).toBe(expectedSpecies); expect(result).toBe(expectedSpecies);
}); });
it("should return Arceus for the 10th of July", () => { it("should return Arceus for the 10th of July", () => {
const scene = new BattleScene(); const scene = game.scene;
const timestamp = new Date(2024, 6, 10, 15, 0, 0, 0).getTime(); const timestamp = new Date(2024, 6, 10, 15, 0, 0, 0).getTime();
const expectedSpecies = Species.ARCEUS; const expectedSpecies = Species.ARCEUS;