mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 09:02:47 +02:00
https://github.com/pagefaultgames/pokerogue/pull/5927/ * Removed unnecessary test timeout parameters from test files We set it in vitest config anyways * Removed unneeded `mockRestore` calls We call `restoreAllMocks` after each test runs anyhow * Removed accidentall forgotten-about timeout * Revdrt magic bounce test file for now * Fixed ting * Fixed bug * Fixed import * Update test/data/status_effect.test.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Update battle.test.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Ran bim --------- Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
45 lines
1.8 KiB
TypeScript
45 lines
1.8 KiB
TypeScript
import type { GameMode } from "#app/game-mode";
|
|
import { getGameMode } from "#app/game-mode";
|
|
import { GameModes } from "#enums/game-modes";
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
|
import * as Utils from "#app/utils/common";
|
|
import GameManager from "#test/testUtils/gameManager";
|
|
|
|
describe("game-mode", () => {
|
|
let phaserGame: Phaser.Game;
|
|
let game: GameManager;
|
|
beforeAll(() => {
|
|
phaserGame = new Phaser.Game({
|
|
type: Phaser.HEADLESS,
|
|
});
|
|
});
|
|
afterEach(() => {
|
|
game.phaseInterceptor.restoreOg();
|
|
});
|
|
beforeEach(() => {
|
|
game = new GameManager(phaserGame);
|
|
});
|
|
describe("classic", () => {
|
|
let classicGameMode: GameMode;
|
|
beforeEach(() => {
|
|
classicGameMode = getGameMode(GameModes.CLASSIC);
|
|
});
|
|
it("does NOT spawn trainers within 3 waves of fixed battle", () => {
|
|
const { arena } = game.scene;
|
|
/** set wave 16 to be a fixed trainer fight meaning wave 13-19 don't allow trainer spawns */
|
|
vi.spyOn(classicGameMode, "isFixedBattle").mockImplementation((n: number) => n === 16);
|
|
vi.spyOn(arena, "getTrainerChance").mockReturnValue(1);
|
|
vi.spyOn(Utils, "randSeedInt").mockReturnValue(0);
|
|
expect(classicGameMode.isWaveTrainer(11, arena)).toBeFalsy();
|
|
expect(classicGameMode.isWaveTrainer(12, arena)).toBeTruthy();
|
|
expect(classicGameMode.isWaveTrainer(13, arena)).toBeFalsy();
|
|
expect(classicGameMode.isWaveTrainer(14, arena)).toBeFalsy();
|
|
expect(classicGameMode.isWaveTrainer(15, arena)).toBeFalsy();
|
|
// Wave 16 is a fixed trainer battle
|
|
expect(classicGameMode.isWaveTrainer(17, arena)).toBeFalsy();
|
|
expect(classicGameMode.isWaveTrainer(18, arena)).toBeFalsy();
|
|
expect(classicGameMode.isWaveTrainer(19, arena)).toBeFalsy();
|
|
});
|
|
});
|
|
});
|