From ed89dbe7283254306b32d775afb057d26ae17e73 Mon Sep 17 00:00:00 2001 From: frutescens Date: Thu, 22 Aug 2024 13:19:52 -0700 Subject: [PATCH] This does not work --- src/test/phases/learn_move_phase.test.ts | 46 ++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/test/phases/learn_move_phase.test.ts diff --git a/src/test/phases/learn_move_phase.test.ts b/src/test/phases/learn_move_phase.test.ts new file mode 100644 index 00000000000..33197ffede7 --- /dev/null +++ b/src/test/phases/learn_move_phase.test.ts @@ -0,0 +1,46 @@ +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; +import Phaser from "phaser"; +import GameManager from "#test/utils/gameManager"; +import { Species } from "#enums/species"; +import * as Utils from "#app/utils"; +import { Moves } from "#enums/moves"; +import { allMoves } from "#app/data/move"; +import { SPLASH_ONLY } from "#test/utils/testUtils"; +import { LearnMovePhase } from "#app/phases/learn-move-phase" + +describe("Learn Move Phase", () => { + let phaserGame: Phaser.Game; + let game: GameManager; + let scene: BattleScene; + + beforeAll(() => { + phaserGame = new Phaser.Game({ + type: Phaser.HEADLESS, + }); + }); + + afterEach(() => { + game.phaseInterceptor.restoreOg(); + }); + + beforeEach(() => { + game = new GameManager(phaserGame); + scene = game.scene; + }); + + describe("If Pokemon has less than 4 moves, its newest move will be added to the lowest empty index", () => { + it("new move should be found at index 1", async () => { + game.override.moveset(SPLASH_ONLY); + await game.startBattle([Species.BULBASAUR]); + const pokemon = game.scene.getPlayerPokemon()!; + const prevLength = pokemon?.getMoveset().length; + pokemon?.addExp(1000); + await game.phaseInterceptor.to(LearnMovePhase, false); + const phase = game.scene.getCurrentPhase() as MoveLearnPhase; + const newMove = phase.moveId; + const messageMode = phase.messageMode; + + console.log(allMoves[newMove]); + }); + }); +}); \ No newline at end of file