diff --git a/test/abilities/wimp-out.test.ts b/test/abilities/wimp-out.test.ts index a32ecaf5983..a1c19a12fd4 100644 --- a/test/abilities/wimp-out.test.ts +++ b/test/abilities/wimp-out.test.ts @@ -547,7 +547,7 @@ describe("Abilities - Wimp Out", () => { await game.move.selectEnemyMove(MoveId.SPLASH); await game.move.selectEnemyMove(MoveId.ENDURE); - await game.toNextWave(); + await game.phaseInterceptor.to("SelectModifierPhase"); expect(game.scene.currentBattle.waveIndex).toBe(wave + 1); }); }); diff --git a/test/battle/battle-order.test.ts b/test/battle/battle-order.test.ts index 5939830e044..c6b014874e5 100644 --- a/test/battle/battle-order.test.ts +++ b/test/battle/battle-order.test.ts @@ -39,7 +39,7 @@ describe("Battle order", () => { vi.spyOn(enemyPokemon, "stats", "get").mockReturnValue([20, 20, 20, 20, 20, 150]); // set enemyPokemon's speed to 150 game.move.select(MoveId.TACKLE); - await game.phaseInterceptor.to("TurnStartPhase"); + await game.phaseInterceptor.to("TurnStartPhase", false); const playerPokemonIndex = playerPokemon.getBattlerIndex(); const enemyPokemonIndex = enemyPokemon.getBattlerIndex(); @@ -58,7 +58,7 @@ describe("Battle order", () => { vi.spyOn(enemyPokemon, "stats", "get").mockReturnValue([20, 20, 20, 20, 20, 50]); // set enemyPokemon's speed to 50 game.move.select(MoveId.TACKLE); - await game.phaseInterceptor.to("TurnStartPhase"); + await game.phaseInterceptor.to("TurnStartPhase", false); const playerPokemonIndex = playerPokemon.getBattlerIndex(); const enemyPokemonIndex = enemyPokemon.getBattlerIndex(); diff --git a/test/battle/battle.test.ts b/test/battle/battle.test.ts index 7c97ea57e0d..e5696bbb394 100644 --- a/test/battle/battle.test.ts +++ b/test/battle/battle.test.ts @@ -76,6 +76,68 @@ describe("Phase - Battle Phase", () => { } }); + it("wrong phase", async () => { + await game.phaseInterceptor.run(LoginPhase); + await game.phaseInterceptor.run(LoginPhase).catch(e => { + expect(e).toBe("Wrong phase: this is SelectGenderPhase and not LoginPhase"); + }); + }); + + it("wrong phase but skip", async () => { + await game.phaseInterceptor.run(LoginPhase); + await game.phaseInterceptor.run(LoginPhase, () => game.isCurrentPhase(SelectGenderPhase)); + }); + + it("good run", async () => { + await game.phaseInterceptor.run(LoginPhase); + game.onNextPrompt( + "SelectGenderPhase", + UiMode.OPTION_SELECT, + () => { + game.scene.gameData.gender = PlayerGender.MALE; + game.endPhase(); + }, + () => game.isCurrentPhase(TitlePhase), + ); + await game.phaseInterceptor.run(SelectGenderPhase, () => game.isCurrentPhase(TitlePhase)); + await game.phaseInterceptor.run(TitlePhase); + }); + + it("good run from select gender to title", async () => { + await game.phaseInterceptor.run(LoginPhase); + game.onNextPrompt( + "SelectGenderPhase", + UiMode.OPTION_SELECT, + () => { + game.scene.gameData.gender = PlayerGender.MALE; + game.endPhase(); + }, + () => game.isCurrentPhase(TitlePhase), + ); + await game.phaseInterceptor.runFrom(SelectGenderPhase).to(TitlePhase); + }); + + it("good run to SummonPhase phase", async () => { + await game.phaseInterceptor.run(LoginPhase); + game.onNextPrompt( + "SelectGenderPhase", + UiMode.OPTION_SELECT, + () => { + game.scene.gameData.gender = PlayerGender.MALE; + game.endPhase(); + }, + () => game.isCurrentPhase(TitlePhase), + ); + game.onNextPrompt("TitlePhase", UiMode.TITLE, () => { + game.scene.gameMode = getGameMode(GameModes.CLASSIC); + const starters = generateStarter(game.scene); + const selectStarterPhase = new SelectStarterPhase(); + game.scene.phaseManager.pushPhase(new EncounterPhase(false)); + selectStarterPhase.initBattle(starters); + }); + await game.phaseInterceptor.runFrom(SelectGenderPhase).to(SummonPhase); + }); + it.each([ { name: "1v1", double: false, qty: 1 }, { name: "2v1", double: false, qty: 2 }, diff --git a/test/moves/metronome.test.ts b/test/moves/metronome.test.ts index b88206f23d9..e39d24c81db 100644 --- a/test/moves/metronome.test.ts +++ b/test/moves/metronome.test.ts @@ -146,6 +146,6 @@ describe("Moves - Metronome", () => { const hasFled = enemyPokemon.switchOutStatus; expect(!isVisible && hasFled).toBe(true); - await game.toNextWave(); + await game.toNextTurn(); }); });