Changing integer to number in tests

This commit is contained in:
Wlowscha 2025-02-03 22:56:05 +01:00
parent 097d1bc595
commit 1afac4fe93
No known key found for this signature in database
GPG Key ID: 3C8F1AD330565D04
9 changed files with 16 additions and 16 deletions

View File

@ -14,7 +14,7 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vite
describe("Egg Generation Tests", () => { describe("Egg Generation Tests", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
let game: GameManager; let game: GameManager;
const EGG_HATCH_COUNT: integer = 1000; const EGG_HATCH_COUNT: number = 1000;
beforeAll(() => { beforeAll(() => {
phaserGame = new Phaser.Game({ phaserGame = new Phaser.Game({

View File

@ -9,7 +9,7 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vite
describe("Manaphy Eggs", () => { describe("Manaphy Eggs", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
let game: GameManager; let game: GameManager;
const EGG_HATCH_COUNT: integer = 48; const EGG_HATCH_COUNT: number = 48;
let rngSweepProgress: number = 0; let rngSweepProgress: number = 0;
beforeAll(() => { beforeAll(() => {

View File

@ -372,7 +372,7 @@ describe("Clowning Around - Mystery Encounter", () => {
}); });
}); });
async function addItemToPokemon(scene: BattleScene, pokemon: Pokemon, stackCount: integer, itemType: PokemonHeldItemModifierType) { async function addItemToPokemon(scene: BattleScene, pokemon: Pokemon, stackCount: number, itemType: PokemonHeldItemModifierType) {
const itemMod = itemType.newModifier(pokemon) as PokemonHeldItemModifier; const itemMod = itemType.newModifier(pokemon) as PokemonHeldItemModifier;
itemMod.stackCount = stackCount; itemMod.stackCount = stackCount;
await scene.addModifier(itemMod, true, false, false, true); await scene.addModifier(itemMod, true, false, false, true);

View File

@ -9,12 +9,12 @@ export default class TextInterceptor {
scene.messageWrapper = this; scene.messageWrapper = this;
} }
showText(text: string, delay?: integer, callback?: Function, callbackDelay?: integer, prompt?: boolean, promptDelay?: integer): void { showText(text: string, delay?: number, callback?: Function, callbackDelay?: number, prompt?: boolean, promptDelay?: number): void {
console.log(text); console.log(text);
this.logs.push(text); this.logs.push(text);
} }
showDialogue(text: string, name: string, delay?: integer, callback?: Function, callbackDelay?: integer, promptDelay?: integer): void { showDialogue(text: string, name: string, delay?: number, callback?: Function, callbackDelay?: number, promptDelay?: number): void {
console.log(name, text); console.log(name, text);
this.logs.push(name, text); this.logs.push(name, text);
} }

View File

@ -255,7 +255,7 @@ export default class GameManager {
* @param {BattlerIndex} targetIndex The index of the attack target, or `undefined` for multi-target attacks * @param {BattlerIndex} targetIndex The index of the attack target, or `undefined` for multi-target attacks
* @param movePosition The index of the move in the pokemon's moveset array * @param movePosition The index of the move in the pokemon's moveset array
*/ */
selectTarget(movePosition: integer, targetIndex?: BattlerIndex) { selectTarget(movePosition: number, targetIndex?: BattlerIndex) {
this.onNextPrompt("SelectTargetPhase", Mode.TARGET_SELECT, () => { this.onNextPrompt("SelectTargetPhase", Mode.TARGET_SELECT, () => {
const handler = this.scene.ui.getHandler() as TargetSelectUiHandler; const handler = this.scene.ui.getHandler() as TargetSelectUiHandler;
const move = (this.scene.getCurrentPhase() as SelectTargetPhase).getPokemon().getMoveset()[movePosition]!.getMove(); // TODO: is the bang correct? const move = (this.scene.getCurrentPhase() as SelectTargetPhase).getPokemon().getMoveset()[movePosition]!.getMove(); // TODO: is the bang correct?
@ -387,7 +387,7 @@ export default class GameManager {
* @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. * @returns A promise that resolves with a tuple containing a boolean indicating success and an integer status code.
*/ */
async importData(path): Promise<[boolean, integer]> { async importData(path): Promise<[boolean, number]> {
const saveKey = "x0i2O7WRiANTqPmZ"; const saveKey = "x0i2O7WRiANTqPmZ";
const dataRaw = fs.readFileSync(path, { encoding: "utf8", flag: "r" }); const dataRaw = fs.readFileSync(path, { encoding: "utf8", flag: "r" });
let dataStr = AES.decrypt(dataRaw, saveKey).toString(enc.Utf8); let dataStr = AES.decrypt(dataRaw, saveKey).toString(enc.Utf8);

View File

@ -102,7 +102,7 @@ export class MoveHelper extends GameManagerHelper {
* defaults to 0 (first slot) and 4 aborts the procedure * defaults to 0 (first slot) and 4 aborts the procedure
* @returns a promise that resolves once the move has been successfully learnt * @returns a promise that resolves once the move has been successfully learnt
*/ */
public async learnMove(move: Moves | integer, partyIndex: integer = 0, moveSlotIndex: integer = 0) { public async learnMove(move: Moves | number, partyIndex: number = 0, moveSlotIndex: number = 0) {
return new Promise<void>(async (resolve, reject) => { return new Promise<void>(async (resolve, reject) => {
this.game.scene.pushPhase(new LearnMovePhase(partyIndex, move)); this.game.scene.pushPhase(new LearnMovePhase(partyIndex, move));

View File

@ -30,7 +30,7 @@ export default class InputsHandler {
this.init(); this.init();
} }
pressTouch(button: string, duration: integer): Promise<void> { pressTouch(button: string, duration: number): Promise<void> {
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
this.fakeMobile.touchDown(button); this.fakeMobile.touchDown(button);
await holdOn(duration); await holdOn(duration);
@ -39,7 +39,7 @@ export default class InputsHandler {
}); });
} }
pressGamepadButton(button: integer, duration: integer): Promise<void> { pressGamepadButton(button: number, duration: number): Promise<void> {
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
this.scene.input.gamepad?.emit("down", this.fakePad, { index: button }); this.scene.input.gamepad?.emit("down", this.fakePad, { index: button });
await holdOn(duration); await holdOn(duration);
@ -48,7 +48,7 @@ export default class InputsHandler {
}); });
} }
pressKeyboardKey(key: integer, duration: integer): Promise<void> { pressKeyboardKey(key: number, duration: number): Promise<void> {
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
this.scene.input.keyboard?.emit("keydown", { keyCode: key }); this.scene.input.keyboard?.emit("keydown", { keyCode: key });
await holdOn(duration); await holdOn(duration);

View File

@ -81,11 +81,11 @@ export default class MockText implements MockGameObject {
showText( showText(
text: string, text: string,
delay?: integer | null, delay?: number | null,
callback?: Function | null, callback?: Function | null,
callbackDelay?: integer | null, callbackDelay?: number | null,
prompt?: boolean | null, prompt?: boolean | null,
promptDelay?: integer | null promptDelay?: number | null
) { ) {
this.scene.messageWrapper.showText(text, delay, callback, callbackDelay, prompt, promptDelay); this.scene.messageWrapper.showText(text, delay, callback, callbackDelay, prompt, promptDelay);
if (callback) { if (callback) {
@ -93,7 +93,7 @@ export default class MockText implements MockGameObject {
} }
} }
showDialogue(keyOrText: string, name: string | undefined, delay: integer | null = 0, callback: Function, callbackDelay?: integer, promptDelay?: integer) { showDialogue(keyOrText: string, name: string | undefined, delay: number | null = 0, callback: Function, callbackDelay?: number, promptDelay?: number) {
this.scene.messageWrapper.showDialogue(keyOrText, name, delay, callback, callbackDelay, promptDelay); this.scene.messageWrapper.showDialogue(keyOrText, name, delay, callback, callbackDelay, promptDelay);
if (callback) { if (callback) {
callback(); callback();

View File

@ -18,7 +18,7 @@ export function mockI18next() {
* @param end end number e.g. 10 * @param end end number e.g. 10
* @returns an array of numbers * @returns an array of numbers
*/ */
export function arrayOfRange(start: integer, end: integer) { export function arrayOfRange(start: number, end: number) {
return Array.from({ length: end - start }, (_v, k) => k + start); return Array.from({ length: end - start }, (_v, k) => k + start);
} }