diff --git a/src/phases/title-phase.ts b/src/phases/title-phase.ts index bb1cf6a9619..986c8bdb1f6 100644 --- a/src/phases/title-phase.ts +++ b/src/phases/title-phase.ts @@ -169,7 +169,7 @@ export class TitlePhase extends Phase { } // TODO: Make callers actually wait for the damn save slot to load - async loadSaveSlot(slotId: number): Promise { + private async loadSaveSlot(slotId: number): Promise { globalScene.sessionSlotId = slotId > -1 || !loggedInUser ? slotId : loggedInUser.lastSessionSlot; globalScene.ui.setMode(UiMode.MESSAGE); globalScene.ui.resetModeChain(); diff --git a/test/test-utils/game-manager.ts b/test/test-utils/game-manager.ts index f3745a2199f..2823e033623 100644 --- a/test/test-utils/game-manager.ts +++ b/test/test-utils/game-manager.ts @@ -416,7 +416,7 @@ export class GameManager { * Checks if the current phase matches the target phase. * @param phaseTarget - The target phase. * @returns Whether the current phase matches the target phase - * @deprecated - Use phaseString + * @deprecated - Use `PhaseString` instead */ isCurrentPhase(phaseTarget: PhaseClass): boolean; isCurrentPhase(phaseTarget: PhaseString | PhaseClass): boolean { @@ -425,12 +425,12 @@ export class GameManager { } /** - * Checks if the current mode matches the target mode. + * Check if the current `UiMode` matches the target mode. * @param mode - The target {@linkcode UiMode} to check. * @returns Whether the current mode matches the target mode. */ - isCurrentMode(mode: UiMode) { - return this.scene.ui?.getMode() === mode; + isCurrentMode(mode: UiMode): boolean { + return this.scene.ui.getMode() === mode; } /** @@ -448,10 +448,10 @@ export class GameManager { /** * Imports game data from a file. - * @param path - The path to the data file. + * @param path - The path to the data file * @returns A promise that resolves with a tuple containing a boolean indicating success and an integer status code. */ - async importData(path): Promise<[boolean, number]> { + async importData(path: string): Promise<[boolean, number]> { const saveKey = "x0i2O7WRiANTqPmZ"; const dataRaw = fs.readFileSync(path, { encoding: "utf8", flag: "r" }); let dataStr = AES.decrypt(dataRaw, saveKey).toString(enc.Utf8); diff --git a/test/test-utils/helpers/reload-helper.ts b/test/test-utils/helpers/reload-helper.ts index c92af218b50..835e8d5f58e 100644 --- a/test/test-utils/helpers/reload-helper.ts +++ b/test/test-utils/helpers/reload-helper.ts @@ -18,11 +18,9 @@ export class ReloadHelper extends GameManagerHelper { super(game); // Whenever the game saves the session, save it to the reloadHelper instead - vi.spyOn(game.scene.gameData, "saveAll").mockImplementation(() => { - return new Promise((resolve, _reject) => { - this.sessionData = game.scene.gameData.getSessionSaveData(); - resolve(true); - }); + vi.spyOn(game.scene.gameData, "saveAll").mockImplementation(async () => { + this.sessionData = game.scene.gameData.getSessionSaveData(); + return true; }); } @@ -52,7 +50,7 @@ export class ReloadHelper extends GameManagerHelper { ); this.game.scene.modifiers = []; } - await titlePhase.loadSaveSlot(-1); // Load the desired session data + await titlePhase["loadSaveSlot"](-1); // Load the desired session data // Run through prompts for switching Pokemon, copied from classicModeHelper.ts if (this.game.scene.battleStyle === BattleStyle.SWITCH) {