mirror of
				https://github.com/pagefaultgames/pokerogue.git
				synced 2025-10-31 08:25:58 +01:00 
			
		
		
		
	* Extract Mode enum out of UI and into its own file Reduces circular imports from 909 to 773 * Move around utility files Reduces cyclical dependencies from 773 to 765 * Remove starterColors and bypassLogin from battle-scene Reduces cyclical dependencies from 765 to 623 * Fix test runner error * Update import for bypassLogin in test * Update mocks for utils in tests * Fix broken tests * Update selectWithTera override * Update path for utils in ab-attr.ts * Update path for utils in ability-class.ts * Fix utils import path in healer.test.ts
		
			
				
	
	
		
			46 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import type { GameMode } from "#app/game-mode";
 | |
| import { GameModes, getGameMode } from "#app/game-mode";
 | |
| 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();
 | |
|     vi.clearAllMocks();
 | |
|     vi.resetAllMocks();
 | |
|   });
 | |
|   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();
 | |
|     });
 | |
|   });
 | |
| });
 |