diff --git a/biome.jsonc b/biome.jsonc index 3a2c39e1541..d2678fef289 100644 --- a/biome.jsonc +++ b/biome.jsonc @@ -5,7 +5,7 @@ */ { - "$schema": "https://biomejs.dev/schemas/2.3.2/schema.json", + "$schema": "https://biomejs.dev/schemas/2.3.8/schema.json", "vcs": { "enabled": true, "clientKind": "git", @@ -16,7 +16,7 @@ "enabled": true, "useEditorconfig": true, "indentStyle": "space", - "includes": ["**", "!**/src/data/balance/**"], + "includes": ["**", "!src/data/balance/**"], // TODO: enable formatting of balance folder "lineWidth": 120 }, "files": { @@ -25,18 +25,23 @@ // and having to verify whether each individual file is ignored "includes": [ "**", - "!**/dist", - "!**/coverage", - "!**/assets", - "!**/locales", - "!**/.github", - "!**/node_modules", - "!**/typedoc", + "!!.github", + "!!assets", + "!!coverage", + "!!dist", + "!!docs", + "!!locales", + "!!typedoc", // TODO: lint css and html? - "!**/*.css", - "!**/*.html", + "!!*.css", + "!!*.html", // this file is too big - "!**/src/data/balance/tm-species-map.ts" + "!src/data/balance/tm-species-map.ts", + // there's some sort of bug when Biome parses this file + // relating to recursive variable assignment + // cf https://github.com/biomejs/biome/issues/8204 + // TODO: remove this exclusion when the bug is fixed + "!!test/test-utils/setup/test-end-log.ts" ] }, "assist": { diff --git a/package.json b/package.json index 2f5348b5c5b..c53bfbe0c86 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "update-submodules:remote": "pnpm update-locales:remote && pnpm update-assets:remote" }, "devDependencies": { - "@biomejs/biome": "2.3.2", + "@biomejs/biome": "2.3.8", "@ls-lint/ls-lint": "2.3.1", "@types/crypto-js": "^4.2.2", "@types/jsdom": "^27.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 09cbdd9ae23..a45d078838e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -46,8 +46,8 @@ importers: version: 1.80.17(graphology-types@0.24.8) devDependencies: '@biomejs/biome': - specifier: 2.3.2 - version: 2.3.2 + specifier: 2.3.8 + version: 2.3.8 '@ls-lint/ls-lint': specifier: 2.3.1 version: 2.3.1 @@ -203,59 +203,59 @@ packages: resolution: {integrity: sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA==} engines: {node: '>=6.9.0'} - '@biomejs/biome@2.3.2': - resolution: {integrity: sha512-8e9tzamuDycx7fdrcJ/F/GDZ8SYukc5ud6tDicjjFqURKYFSWMl0H0iXNXZEGmcmNUmABgGuHThPykcM41INgg==} + '@biomejs/biome@2.3.8': + resolution: {integrity: sha512-Qjsgoe6FEBxWAUzwFGFrB+1+M8y/y5kwmg5CHac+GSVOdmOIqsAiXM5QMVGZJ1eCUCLlPZtq4aFAQ0eawEUuUA==} engines: {node: '>=14.21.3'} hasBin: true - '@biomejs/cli-darwin-arm64@2.3.2': - resolution: {integrity: sha512-4LECm4kc3If0JISai4c3KWQzukoUdpxy4fRzlrPcrdMSRFksR9ZoXK7JBcPuLBmd2SoT4/d7CQS33VnZpgBjew==} + '@biomejs/cli-darwin-arm64@2.3.8': + resolution: {integrity: sha512-HM4Zg9CGQ3txTPflxD19n8MFPrmUAjaC7PQdLkugeeC0cQ+PiVrd7i09gaBS/11QKsTDBJhVg85CEIK9f50Qww==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [darwin] - '@biomejs/cli-darwin-x64@2.3.2': - resolution: {integrity: sha512-jNMnfwHT4N3wi+ypRfMTjLGnDmKYGzxVr1EYAPBcauRcDnICFXN81wD6wxJcSUrLynoyyYCdfW6vJHS/IAoTDA==} + '@biomejs/cli-darwin-x64@2.3.8': + resolution: {integrity: sha512-lUDQ03D7y/qEao7RgdjWVGCu+BLYadhKTm40HkpJIi6kn8LSv5PAwRlew/DmwP4YZ9ke9XXoTIQDO1vAnbRZlA==} engines: {node: '>=14.21.3'} cpu: [x64] os: [darwin] - '@biomejs/cli-linux-arm64-musl@2.3.2': - resolution: {integrity: sha512-2Zz4usDG1GTTPQnliIeNx6eVGGP2ry5vE/v39nT73a3cKN6t5H5XxjcEoZZh62uVZvED7hXXikclvI64vZkYqw==} + '@biomejs/cli-linux-arm64-musl@2.3.8': + resolution: {integrity: sha512-PShR4mM0sjksUMyxbyPNMxoKFPVF48fU8Qe8Sfx6w6F42verbwRLbz+QiKNiDPRJwUoMG1nPM50OBL3aOnTevA==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] libc: [musl] - '@biomejs/cli-linux-arm64@2.3.2': - resolution: {integrity: sha512-amnqvk+gWybbQleRRq8TMe0rIv7GHss8mFJEaGuEZYWg1Tw14YKOkeo8h6pf1c+d3qR+JU4iT9KXnBKGON4klw==} + '@biomejs/cli-linux-arm64@2.3.8': + resolution: {integrity: sha512-Uo1OJnIkJgSgF+USx970fsM/drtPcQ39I+JO+Fjsaa9ZdCN1oysQmy6oAGbyESlouz+rzEckLTF6DS7cWse95g==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] libc: [glibc] - '@biomejs/cli-linux-x64-musl@2.3.2': - resolution: {integrity: sha512-gzB19MpRdTuOuLtPpFBGrV3Lq424gHyq2lFj8wfX9tvLMLdmA/R9C7k/mqBp/spcbWuHeIEKgEs3RviOPcWGBA==} + '@biomejs/cli-linux-x64-musl@2.3.8': + resolution: {integrity: sha512-YGLkqU91r1276uwSjiUD/xaVikdxgV1QpsicT0bIA1TaieM6E5ibMZeSyjQ/izBn4tKQthUSsVZacmoJfa3pDA==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] libc: [musl] - '@biomejs/cli-linux-x64@2.3.2': - resolution: {integrity: sha512-8BG/vRAhFz1pmuyd24FQPhNeueLqPtwvZk6yblABY2gzL2H8fLQAF/Z2OPIc+BPIVPld+8cSiKY/KFh6k81xfA==} + '@biomejs/cli-linux-x64@2.3.8': + resolution: {integrity: sha512-QDPMD5bQz6qOVb3kiBui0zKZXASLo0NIQ9JVJio5RveBEFgDgsvJFUvZIbMbUZT3T00M/1wdzwWXk4GIh0KaAw==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] libc: [glibc] - '@biomejs/cli-win32-arm64@2.3.2': - resolution: {integrity: sha512-lCruqQlfWjhMlOdyf5pDHOxoNm4WoyY2vZ4YN33/nuZBRstVDuqPPjS0yBkbUlLEte11FbpW+wWSlfnZfSIZvg==} + '@biomejs/cli-win32-arm64@2.3.8': + resolution: {integrity: sha512-H4IoCHvL1fXKDrTALeTKMiE7GGWFAraDwBYFquE/L/5r1927Te0mYIGseXi4F+lrrwhSWbSGt5qPFswNoBaCxg==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [win32] - '@biomejs/cli-win32-x64@2.3.2': - resolution: {integrity: sha512-6Ee9P26DTb4D8sN9nXxgbi9Dw5vSOfH98M7UlmkjKB2vtUbrRqCbZiNfryGiwnPIpd6YUoTl7rLVD2/x1CyEHQ==} + '@biomejs/cli-win32-x64@2.3.8': + resolution: {integrity: sha512-RguzimPoZWtBapfKhKjcWXBVI91tiSprqdBYu7tWhgN8pKRZhw24rFeNZTNf6UiBfjCYCi9eFQs/JzJZIhuK4w==} engines: {node: '>=14.21.3'} cpu: [x64] os: [win32] @@ -2138,39 +2138,39 @@ snapshots: '@babel/helper-string-parser': 7.27.1 '@babel/helper-validator-identifier': 7.28.5 - '@biomejs/biome@2.3.2': + '@biomejs/biome@2.3.8': optionalDependencies: - '@biomejs/cli-darwin-arm64': 2.3.2 - '@biomejs/cli-darwin-x64': 2.3.2 - '@biomejs/cli-linux-arm64': 2.3.2 - '@biomejs/cli-linux-arm64-musl': 2.3.2 - '@biomejs/cli-linux-x64': 2.3.2 - '@biomejs/cli-linux-x64-musl': 2.3.2 - '@biomejs/cli-win32-arm64': 2.3.2 - '@biomejs/cli-win32-x64': 2.3.2 + '@biomejs/cli-darwin-arm64': 2.3.8 + '@biomejs/cli-darwin-x64': 2.3.8 + '@biomejs/cli-linux-arm64': 2.3.8 + '@biomejs/cli-linux-arm64-musl': 2.3.8 + '@biomejs/cli-linux-x64': 2.3.8 + '@biomejs/cli-linux-x64-musl': 2.3.8 + '@biomejs/cli-win32-arm64': 2.3.8 + '@biomejs/cli-win32-x64': 2.3.8 - '@biomejs/cli-darwin-arm64@2.3.2': + '@biomejs/cli-darwin-arm64@2.3.8': optional: true - '@biomejs/cli-darwin-x64@2.3.2': + '@biomejs/cli-darwin-x64@2.3.8': optional: true - '@biomejs/cli-linux-arm64-musl@2.3.2': + '@biomejs/cli-linux-arm64-musl@2.3.8': optional: true - '@biomejs/cli-linux-arm64@2.3.2': + '@biomejs/cli-linux-arm64@2.3.8': optional: true - '@biomejs/cli-linux-x64-musl@2.3.2': + '@biomejs/cli-linux-x64-musl@2.3.8': optional: true - '@biomejs/cli-linux-x64@2.3.2': + '@biomejs/cli-linux-x64@2.3.8': optional: true - '@biomejs/cli-win32-arm64@2.3.2': + '@biomejs/cli-win32-arm64@2.3.8': optional: true - '@biomejs/cli-win32-x64@2.3.2': + '@biomejs/cli-win32-x64@2.3.8': optional: true '@csstools/color-helpers@5.1.0': {} diff --git a/test/abilities/magic-guard.test.ts b/test/abilities/magic-guard.test.ts index e2977420edf..cab541b6a4e 100644 --- a/test/abilities/magic-guard.test.ts +++ b/test/abilities/magic-guard.test.ts @@ -55,6 +55,7 @@ describe("AbilityId - Magic Guard", () => { expect(magikarp.hp).toBe(magikarp.getMaxHp()); }); + // biome-ignore format: prefer pre-2.3.6 formatting it.each<{ abName: string; move?: MoveId; enemyMove?: MoveId; passive?: AbilityId; enemyAbility?: AbilityId }>([ { abName: "Bad Dreams", enemyMove: MoveId.SPORE, enemyAbility: AbilityId.BAD_DREAMS }, { abName: "Aftermath", move: MoveId.PSYCHIC_FANGS, enemyAbility: AbilityId.AFTERMATH }, diff --git a/test/abilities/moxie.test.ts b/test/abilities/moxie.test.ts index d762187baba..d6b429d72e5 100644 --- a/test/abilities/moxie.test.ts +++ b/test/abilities/moxie.test.ts @@ -49,25 +49,21 @@ describe("Abilities - Moxie", () => { }); // TODO: Activate this test when MOXIE is corrected to work on faint and not on battle victory - it.todo( - "should raise ATK stat stage by 1 when defeating an ally Pokemon", - async () => { - game.override.battleStyle("double"); - const moveToUse = MoveId.AERIAL_ACE; - await game.classicMode.startBattle([SpeciesId.MIGHTYENA, SpeciesId.MIGHTYENA]); + it.todo("should raise ATK stat stage by 1 when defeating an ally Pokemon", async () => { + game.override.battleStyle("double"); + const moveToUse = MoveId.AERIAL_ACE; + await game.classicMode.startBattle([SpeciesId.MIGHTYENA, SpeciesId.MIGHTYENA]); - const [firstPokemon, secondPokemon] = game.scene.getPlayerField(); + const [firstPokemon, secondPokemon] = game.scene.getPlayerField(); - expect(firstPokemon.getStatStage(Stat.ATK)).toBe(0); + expect(firstPokemon.getStatStage(Stat.ATK)).toBe(0); - secondPokemon.hp = 1; + secondPokemon.hp = 1; - game.move.select(moveToUse, BattlerIndex.PLAYER_2); + game.move.select(moveToUse, BattlerIndex.PLAYER_2); - await game.phaseInterceptor.to("TurnEndPhase"); + await game.phaseInterceptor.to("TurnEndPhase"); - expect(firstPokemon.getStatStage(Stat.ATK)).toBe(1); - }, - 20000, - ); + expect(firstPokemon.getStatStage(Stat.ATK)).toBe(1); + }, 20000); }); diff --git a/test/abilities/protean-libero.test.ts b/test/abilities/protean-libero.test.ts index 305955f5221..deb5cddb8ee 100644 --- a/test/abilities/protean-libero.test.ts +++ b/test/abilities/protean-libero.test.ts @@ -121,6 +121,7 @@ describe("Abilities - Protean/Libero", () => { expectTypeChange(bulbasaur); }); + // biome-ignore format: prefer pre-2.3.6 formatting it.each<{ category: string; move?: MoveId; passive?: AbilityId; enemyMove?: MoveId }>([ { category: "Variable type Moves'", move: MoveId.WEATHER_BALL, passive: AbilityId.DROUGHT }, { category: "Type Change Abilities'", passive: AbilityId.REFRIGERATE }, @@ -146,6 +147,7 @@ describe("Abilities - Protean/Libero", () => { }, ); + // biome-ignore format: prefer pre-2.3.6 formatting it.each<{ cause: string; move?: MoveId; passive?: AbilityId; enemyMove?: MoveId }>([ { cause: "misses", move: MoveId.FOCUS_BLAST }, { cause: "is protected against", enemyMove: MoveId.PROTECT }, diff --git a/test/abilities/shields-down.test.ts b/test/abilities/shields-down.test.ts index ff07f2c9560..71a7cca5061 100644 --- a/test/abilities/shields-down.test.ts +++ b/test/abilities/shields-down.test.ts @@ -35,33 +35,31 @@ describe("Abilities - Shields Down", () => { .enemyMoveset(MoveId.SPLASH); }); - it.each([0, 1, 2, 3, 4, 5, 6])( - "should change from Meteor Form to Core Form on entry/turn end based on HP - form index %i", - async meteorIndex => { - game.override.starterForms({ - // Start in meteor form - [SpeciesId.MINIOR]: meteorIndex, - }); + it.each([0, 1, 2, 3, 4, 5, 6])(// + "should change from Meteor Form to Core Form on entry/turn end based on HP - form index %i", async meteorIndex => { + game.override.starterForms({ + // Start in meteor form + [SpeciesId.MINIOR]: meteorIndex, + }); - await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MINIOR]); + await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MINIOR]); - const minior = game.scene.getPlayerParty()[1]; - expect(minior.formIndex).toBe(meteorIndex); - minior.hp *= 0.49; + const minior = game.scene.getPlayerParty()[1]; + expect(minior.formIndex).toBe(meteorIndex); + minior.hp *= 0.49; - // Switch to minior - should change to Core due to being <50% HP - game.doSwitchPokemon(1); - await game.toNextTurn(); + // Switch to minior - should change to Core due to being <50% HP + game.doSwitchPokemon(1); + await game.toNextTurn(); - expect(minior.formIndex).toBe(meteorIndex + 7); + expect(minior.formIndex).toBe(meteorIndex + 7); - // Use roost to regain 50% HP; should transform back into Meteor Form at turn end - game.move.use(MoveId.ROOST); - await game.toNextTurn(); + // Use roost to regain 50% HP; should transform back into Meteor Form at turn end + game.move.use(MoveId.ROOST); + await game.toNextTurn(); - expect(minior.formIndex).toBe(meteorIndex); - }, - ); + expect(minior.formIndex).toBe(meteorIndex); + }); it("should revert to base form on arena reset, even when fainted", async () => { game.override.startingWave(4).starterForms({ diff --git a/test/abilities/status-immunity-ab-attrs.test.ts b/test/abilities/status-immunity-ab-attrs.test.ts index 7df621d5577..513a3f4432d 100644 --- a/test/abilities/status-immunity-ab-attrs.test.ts +++ b/test/abilities/status-immunity-ab-attrs.test.ts @@ -79,17 +79,14 @@ describe.each<{ name: string; ability: AbilityId; status: StatusEffect }>([ }); // TODO: This does not propagate failures currently - it.todo( - `should cause status moves inflicting ${statusStr} to count as failed if no other effects can be applied`, - async () => { - await game.classicMode.startBattle([SpeciesId.FEEBAS]); + it.todo(`should cause status moves inflicting ${statusStr} to count as failed if no other effects can be applied`, async () => { + await game.classicMode.startBattle([SpeciesId.FEEBAS]); - game.move.use(MoveId.SPORE); - await game.toEndOfTurn(); + game.move.use(MoveId.SPORE); + await game.toEndOfTurn(); - const karp = game.field.getEnemyPokemon(); - expect(karp.status?.effect).toBeUndefined(); - expect(game.field.getPlayerPokemon().getLastXMoves()[0].result).toBe(MoveResult.FAIL); - }, - ); + const karp = game.field.getEnemyPokemon(); + expect(karp.status?.effect).toBeUndefined(); + expect(game.field.getPlayerPokemon().getLastXMoves()[0].result).toBe(MoveResult.FAIL); + }); }); diff --git a/test/abilities/wimp-out.test.ts b/test/abilities/wimp-out.test.ts index 46fd5094255..1caf9bf7701 100644 --- a/test/abilities/wimp-out.test.ts +++ b/test/abilities/wimp-out.test.ts @@ -199,29 +199,26 @@ describe("Abilities - Wimp Out", () => { // TODO: Enable when this behavior is fixed (currently Shell Bell won't activate if Wimp Out activates because // the pokemon is removed from the field before the Shell Bell modifier is applied, so it can't see the // damage dealt and doesn't heal the pokemon) - it.todo( - "If it falls below half and recovers back above half from a Shell Bell, Wimp Out will activate even after the Shell Bell recovery", - async () => { - game.override - .moveset([MoveId.DOUBLE_EDGE]) - .enemyMoveset([MoveId.SPLASH]) - .startingHeldItems([{ name: "SHELL_BELL", count: 4 }]); - await game.classicMode.startBattle([SpeciesId.WIMPOD, SpeciesId.TYRUNT]); + it.todo("If it falls below half and recovers back above half from a Shell Bell, Wimp Out will activate even after the Shell Bell recovery", async () => { + game.override + .moveset([MoveId.DOUBLE_EDGE]) + .enemyMoveset([MoveId.SPLASH]) + .startingHeldItems([{ name: "SHELL_BELL", count: 4 }]); + await game.classicMode.startBattle([SpeciesId.WIMPOD, SpeciesId.TYRUNT]); - const wimpod = game.field.getPlayerPokemon(); + const wimpod = game.field.getPlayerPokemon(); - wimpod.damageAndUpdate(toDmgValue(wimpod.getMaxHp() * 0.4)); + wimpod.damageAndUpdate(toDmgValue(wimpod.getMaxHp() * 0.4)); - game.move.select(MoveId.DOUBLE_EDGE); - game.doSelectPartyPokemon(1); - await game.phaseInterceptor.to("TurnEndPhase"); + game.move.select(MoveId.DOUBLE_EDGE); + game.doSelectPartyPokemon(1); + await game.phaseInterceptor.to("TurnEndPhase"); - expect(game.scene.getPlayerParty()[1]).toBe(wimpod); - expect(wimpod.hp).toBeGreaterThan(toDmgValue(wimpod.getMaxHp() / 2)); - expect(game.phaseInterceptor.log).toContain("SwitchSummonPhase"); - expect(game.field.getPlayerPokemon().species.speciesId).toBe(SpeciesId.TYRUNT); - }, - ); + expect(game.scene.getPlayerParty()[1]).toBe(wimpod); + expect(wimpod.hp).toBeGreaterThan(toDmgValue(wimpod.getMaxHp() / 2)); + expect(game.phaseInterceptor.log).toContain("SwitchSummonPhase"); + expect(game.field.getPlayerPokemon().species.speciesId).toBe(SpeciesId.TYRUNT); + }); it("Wimp Out will activate due to weather damage", async () => { game.override.weather(WeatherType.HAIL).enemyMoveset([MoveId.SPLASH]); @@ -460,26 +457,23 @@ describe("Abilities - Wimp Out", () => { }); // TODO: This interaction is not implemented yet - it.todo( - "Wimp Out will not activate if the Pokémon's HP falls below half due to hurting itself in confusion", - async () => { - game.override.moveset([MoveId.SWORDS_DANCE]).enemyMoveset([MoveId.SWAGGER]); - await game.classicMode.startBattle([SpeciesId.WIMPOD, SpeciesId.TYRUNT]); - const playerPokemon = game.field.getPlayerPokemon(); - playerPokemon.hp *= 0.51; - playerPokemon.setStatStage(Stat.ATK, 6); - playerPokemon.addTag(BattlerTagType.CONFUSED); + it.todo("Wimp Out will not activate if the Pokémon's HP falls below half due to hurting itself in confusion", async () => { + game.override.moveset([MoveId.SWORDS_DANCE]).enemyMoveset([MoveId.SWAGGER]); + await game.classicMode.startBattle([SpeciesId.WIMPOD, SpeciesId.TYRUNT]); + const playerPokemon = game.field.getPlayerPokemon(); + playerPokemon.hp *= 0.51; + playerPokemon.setStatStage(Stat.ATK, 6); + playerPokemon.addTag(BattlerTagType.CONFUSED); - // TODO: add helper function to force confusion self-hits + // TODO: add helper function to force confusion self-hits - while (playerPokemon.getHpRatio() > 0.49) { - game.move.select(MoveId.SWORDS_DANCE); - await game.phaseInterceptor.to("TurnEndPhase"); - } + while (playerPokemon.getHpRatio() > 0.49) { + game.move.select(MoveId.SWORDS_DANCE); + await game.phaseInterceptor.to("TurnEndPhase"); + } - confirmNoSwitch(); - }, - ); + confirmNoSwitch(); + }); it("should not activate on wave X0 bosses", async () => { game.override.enemyAbility(AbilityId.WIMP_OUT).startingLevel(5850).startingWave(10); diff --git a/test/arena/arena-tags.test.ts b/test/arena/arena-tags.test.ts index 1d0c0cf1fd8..4be8729ab5e 100644 --- a/test/arena/arena-tags.test.ts +++ b/test/arena/arena-tags.test.ts @@ -65,6 +65,7 @@ describe("Arena Tags", () => { })), ); + // biome-ignore format: prefer pre-2.3.6 formatting it.each(arenaTags)( "$name should display a message on addition, and a separate one on removal - $sideName", ({ tagType, side }) => { diff --git a/test/field/pokemon.test.ts b/test/field/pokemon.test.ts index 2bf2e0b23b2..94b3a2316ea 100644 --- a/test/field/pokemon.test.ts +++ b/test/field/pokemon.test.ts @@ -199,19 +199,17 @@ describe("Spec - Pokemon", () => { }); }); - it.each([5, 25, 55, 95, 145, 195])( - "should set minimum IVs for enemy trainer pokemon based on wave (%i)", - async wave => { - game.override.startingWave(wave); - await game.classicMode.runToSummon([SpeciesId.FEEBAS]); + it.each([5, 25, 55, 95, 145, 195])(// + "should set minimum IVs for enemy trainer pokemon based on wave (%i)", async wave => { + game.override.startingWave(wave); + await game.classicMode.runToSummon([SpeciesId.FEEBAS]); - for (const pokemon of game.field.getEnemyParty()) { - for (const iv of pokemon.ivs) { - expect(iv).toBeGreaterThanOrEqual(Math.floor(wave / 10)); - } + for (const pokemon of game.field.getEnemyParty()) { + for (const iv of pokemon.ivs) { + expect(iv).toBeGreaterThanOrEqual(Math.floor(wave / 10)); } - }, - ); + } + }); it.each([ { wave: 5, friendship: 6 }, diff --git a/test/items/multi-lens.test.ts b/test/items/multi-lens.test.ts index bdf93a4ae12..aff9cc148f6 100644 --- a/test/items/multi-lens.test.ts +++ b/test/items/multi-lens.test.ts @@ -37,6 +37,7 @@ describe("Items - Multi Lens", () => { .enemyLevel(99); }); + // biome-ignore format: prefer pre-2.3.6 formatting it.each([ { stackCount: 1, firstHitDamage: 0.75 }, { stackCount: 2, firstHitDamage: 0.5 }, diff --git a/test/moves/magic-coat.test.ts b/test/moves/magic-coat.test.ts index 7c1c703119d..73ffbf2c2fb 100644 --- a/test/moves/magic-coat.test.ts +++ b/test/moves/magic-coat.test.ts @@ -219,30 +219,27 @@ describe("Moves - Magic Coat", () => { }); // TODO: stomping tantrum should consider moves that were bounced. - it.todo( - "should properly cause the enemy's stomping tantrum to be doubled in power after bouncing and failing", - async () => { - game.override.enemyMoveset([MoveId.STOMPING_TANTRUM, MoveId.SPLASH, MoveId.CHARM]); - await game.classicMode.startBattle([SpeciesId.BULBASAUR]); + it.todo("should properly cause the enemy's stomping tantrum to be doubled in power after bouncing and failing", async () => { + game.override.enemyMoveset([MoveId.STOMPING_TANTRUM, MoveId.SPLASH, MoveId.CHARM]); + await game.classicMode.startBattle([SpeciesId.BULBASAUR]); - const stomping_tantrum = allMoves[MoveId.STOMPING_TANTRUM]; - const enemy = game.field.getEnemyPokemon(); - vi.spyOn(stomping_tantrum, "calculateBattlePower"); + const stomping_tantrum = allMoves[MoveId.STOMPING_TANTRUM]; + const enemy = game.field.getEnemyPokemon(); + vi.spyOn(stomping_tantrum, "calculateBattlePower"); - game.move.select(MoveId.SPORE); - await game.move.selectEnemyMove(MoveId.CHARM); - await game.phaseInterceptor.to("TurnEndPhase"); - expect(enemy.getLastXMoves(1)[0].result).toBe("success"); + game.move.select(MoveId.SPORE); + await game.move.selectEnemyMove(MoveId.CHARM); + await game.phaseInterceptor.to("TurnEndPhase"); + expect(enemy.getLastXMoves(1)[0].result).toBe("success"); - await game.phaseInterceptor.to("BerryPhase"); - expect(stomping_tantrum.calculateBattlePower).toHaveReturnedWith(75); + await game.phaseInterceptor.to("BerryPhase"); + expect(stomping_tantrum.calculateBattlePower).toHaveReturnedWith(75); - await game.toNextTurn(); - game.move.select(MoveId.GROWL); - await game.phaseInterceptor.to("BerryPhase"); - expect(stomping_tantrum.calculateBattlePower).toHaveReturnedWith(75); - }, - ); + await game.toNextTurn(); + game.move.select(MoveId.GROWL); + await game.phaseInterceptor.to("BerryPhase"); + expect(stomping_tantrum.calculateBattlePower).toHaveReturnedWith(75); + }); it("should respect immunities when bouncing a move", async () => { vi.spyOn(allMoves[MoveId.THUNDER_WAVE], "accuracy", "get").mockReturnValue(100); diff --git a/test/moves/order-up.test.ts b/test/moves/order-up.test.ts index 2da7cc5daf8..5f19f8f9b97 100644 --- a/test/moves/order-up.test.ts +++ b/test/moves/order-up.test.ts @@ -40,6 +40,7 @@ describe("Moves - Order Up", () => { vi.spyOn(game.scene, "triggerPokemonBattleAnim").mockReturnValue(true); }); + // biome-ignore format: prefer pre-2.3.6 formatting it.each([ { formIndex: 0, formName: "Curly", stat: Stat.ATK, statName: "Attack" }, { formIndex: 1, formName: "Droopy", stat: Stat.DEF, statName: "Defense" }, diff --git a/test/moves/parting-shot.test.ts b/test/moves/parting-shot.test.ts index e9400aef29b..2d452f3adfc 100644 --- a/test/moves/parting-shot.test.ts +++ b/test/moves/parting-shot.test.ts @@ -60,113 +60,101 @@ describe("Moves - Parting Shot", () => { expect(game.scene.getPlayerField()[0].species.speciesId).toBe(SpeciesId.MURKROW); }); - it.todo( - // TODO: fix this bug to pass the test! - "Parting shot should fail if target is -6/-6 de-buffed", - async () => { - game.override.moveset([MoveId.PARTING_SHOT, MoveId.MEMENTO, MoveId.SPLASH]); - await game.classicMode.startBattle([ - SpeciesId.MEOWTH, - SpeciesId.MEOWTH, - SpeciesId.MEOWTH, - SpeciesId.MURKROW, - SpeciesId.ABRA, - ]); + // TODO: fix this bug to pass the test! + it.todo("Parting shot should fail if target is -6/-6 de-buffed", async () => { + game.override.moveset([MoveId.PARTING_SHOT, MoveId.MEMENTO, MoveId.SPLASH]); + await game.classicMode.startBattle([ + SpeciesId.MEOWTH, + SpeciesId.MEOWTH, + SpeciesId.MEOWTH, + SpeciesId.MURKROW, + SpeciesId.ABRA, + ]); - // use Memento 3 times to debuff enemy - game.move.select(MoveId.MEMENTO); - await game.phaseInterceptor.to("FaintPhase"); - expect(game.field.getPlayerPokemon().isFainted()).toBe(true); - game.doSelectPartyPokemon(1); + // use Memento 3 times to debuff enemy + game.move.select(MoveId.MEMENTO); + await game.phaseInterceptor.to("FaintPhase"); + expect(game.field.getPlayerPokemon().isFainted()).toBe(true); + game.doSelectPartyPokemon(1); - await game.phaseInterceptor.to("TurnInitPhase", false); - game.move.select(MoveId.MEMENTO); - await game.phaseInterceptor.to("FaintPhase"); - expect(game.field.getPlayerPokemon().isFainted()).toBe(true); - game.doSelectPartyPokemon(2); + await game.phaseInterceptor.to("TurnInitPhase", false); + game.move.select(MoveId.MEMENTO); + await game.phaseInterceptor.to("FaintPhase"); + expect(game.field.getPlayerPokemon().isFainted()).toBe(true); + game.doSelectPartyPokemon(2); - await game.phaseInterceptor.to("TurnInitPhase", false); - game.move.select(MoveId.MEMENTO); - await game.phaseInterceptor.to("FaintPhase"); - expect(game.field.getPlayerPokemon().isFainted()).toBe(true); - game.doSelectPartyPokemon(3); + await game.phaseInterceptor.to("TurnInitPhase", false); + game.move.select(MoveId.MEMENTO); + await game.phaseInterceptor.to("FaintPhase"); + expect(game.field.getPlayerPokemon().isFainted()).toBe(true); + game.doSelectPartyPokemon(3); - // set up done - await game.phaseInterceptor.to("TurnInitPhase", false); - const enemyPokemon = game.field.getEnemyPokemon(); - expect(enemyPokemon).toBeDefined(); + // set up done + await game.phaseInterceptor.to("TurnInitPhase", false); + const enemyPokemon = game.field.getEnemyPokemon(); + expect(enemyPokemon).toBeDefined(); - expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(-6); - expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(-6); + expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(-6); + expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(-6); - // now parting shot should fail - game.move.select(MoveId.PARTING_SHOT); + // now parting shot should fail + game.move.select(MoveId.PARTING_SHOT); - await game.phaseInterceptor.to("BerryPhase", false); - expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(-6); - expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(-6); - expect(game.scene.getPlayerField()[0].species.speciesId).toBe(SpeciesId.MURKROW); - }, - ); + await game.phaseInterceptor.to("BerryPhase", false); + expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(-6); + expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(-6); + expect(game.scene.getPlayerField()[0].species.speciesId).toBe(SpeciesId.MURKROW); + }); - it.todo( - // TODO: fix this bug to pass the test! - "Parting shot shouldn't allow switch out when mist is active", - async () => { - game.override.enemySpecies(SpeciesId.ALTARIA).enemyAbility(AbilityId.NONE).enemyMoveset([MoveId.MIST]); - await game.classicMode.startBattle([SpeciesId.SNORLAX, SpeciesId.MEOWTH]); + // TODO: fix this bug to pass the test! + it.todo("Parting shot shouldn't allow switch out when mist is active", async () => { + game.override.enemySpecies(SpeciesId.ALTARIA).enemyAbility(AbilityId.NONE).enemyMoveset([MoveId.MIST]); + await game.classicMode.startBattle([SpeciesId.SNORLAX, SpeciesId.MEOWTH]); - const enemyPokemon = game.field.getEnemyPokemon(); - expect(enemyPokemon).toBeDefined(); + const enemyPokemon = game.field.getEnemyPokemon(); + expect(enemyPokemon).toBeDefined(); - game.move.select(MoveId.PARTING_SHOT); + game.move.select(MoveId.PARTING_SHOT); - await game.phaseInterceptor.to("BerryPhase", false); - expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(0); - expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(0); - expect(game.scene.getPlayerField()[0].species.speciesId).toBe(SpeciesId.MURKROW); - }, - ); + await game.phaseInterceptor.to("BerryPhase", false); + expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(0); + expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(0); + expect(game.scene.getPlayerField()[0].species.speciesId).toBe(SpeciesId.MURKROW); + }); - it.todo( - // TODO: fix this bug to pass the test! - "Parting shot shouldn't allow switch out against clear body ability", - async () => { - game.override.enemySpecies(SpeciesId.TENTACOOL).enemyAbility(AbilityId.CLEAR_BODY); - await game.classicMode.startBattle([SpeciesId.SNORLAX, SpeciesId.MEOWTH]); + // TODO: fix this bug to pass the test! + it.todo("Parting shot shouldn't allow switch out against clear body ability", async () => { + game.override.enemySpecies(SpeciesId.TENTACOOL).enemyAbility(AbilityId.CLEAR_BODY); + await game.classicMode.startBattle([SpeciesId.SNORLAX, SpeciesId.MEOWTH]); - const enemyPokemon = game.field.getEnemyPokemon(); - expect(enemyPokemon).toBeDefined(); + const enemyPokemon = game.field.getEnemyPokemon(); + expect(enemyPokemon).toBeDefined(); - game.move.select(MoveId.PARTING_SHOT); + game.move.select(MoveId.PARTING_SHOT); - await game.phaseInterceptor.to("BerryPhase", false); - expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(0); - expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(0); - expect(game.scene.getPlayerField()[0].species.speciesId).toBe(SpeciesId.MURKROW); - }, - ); + await game.phaseInterceptor.to("BerryPhase", false); + expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(0); + expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(0); + expect(game.scene.getPlayerField()[0].species.speciesId).toBe(SpeciesId.MURKROW); + }); - it.todo( - // TODO: fix this bug to pass the test! - "should lower stats without failing if no alive party members available to switch", - async () => { - await game.classicMode.startBattle([SpeciesId.MURKROW, SpeciesId.MEOWTH]); + // TODO: fix this bug to pass the test! + it.todo("should lower stats without failing if no alive party members available to switch", async () => { + await game.classicMode.startBattle([SpeciesId.MURKROW, SpeciesId.MEOWTH]); - const meowth = game.scene.getPlayerParty()[1]; - meowth.hp = 0; + const meowth = game.scene.getPlayerParty()[1]; + meowth.hp = 0; - game.move.select(MoveId.SPLASH); - await game.toNextTurn(); + game.move.select(MoveId.SPLASH); + await game.toNextTurn(); - game.move.select(MoveId.PARTING_SHOT); - game.doSelectPartyPokemon(1); - await game.toEndOfTurn(); + game.move.select(MoveId.PARTING_SHOT); + game.doSelectPartyPokemon(1); + await game.toEndOfTurn(); - const enemyPokemon = game.field.getEnemyPokemon(); - expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(0); - expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(0); - expect(game.field.getPlayerPokemon().species.speciesId).toBe(SpeciesId.MURKROW); - }, - ); + const enemyPokemon = game.field.getEnemyPokemon(); + expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(0); + expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(0); + expect(game.field.getPlayerPokemon().species.speciesId).toBe(SpeciesId.MURKROW); + }); }); diff --git a/test/ui/battle-info.test.ts b/test/ui/battle-info.test.ts index 8bdd61e05b0..855614b8712 100644 --- a/test/ui/battle-info.test.ts +++ b/test/ui/battle-info.test.ts @@ -38,19 +38,20 @@ describe("UI - Battle Info", () => { .enemySpecies(SpeciesId.CATERPIE); }); - it.each([ExpGainsSpeed.FAST, ExpGainsSpeed.FASTER, ExpGainsSpeed.SKIP])( - "should increase exp gains animation by 2^%i", - async expGainsSpeed => { - game.settings.expGainsSpeed(expGainsSpeed); - vi.spyOn(Math, "pow"); + it.each([ + ExpGainsSpeed.FAST, + ExpGainsSpeed.FASTER, + ExpGainsSpeed.SKIP, + ])("should increase exp gains animation by 2^%i", async expGainsSpeed => { + game.settings.expGainsSpeed(expGainsSpeed); + vi.spyOn(Math, "pow"); - await game.classicMode.startBattle([SpeciesId.CHARIZARD]); + await game.classicMode.startBattle([SpeciesId.CHARIZARD]); - game.move.select(MoveId.SPLASH); - await game.doKillOpponents(); - await game.phaseInterceptor.to(ExpPhase, true); + game.move.select(MoveId.SPLASH); + await game.doKillOpponents(); + await game.phaseInterceptor.to(ExpPhase, true); - expect(Math.pow).not.toHaveBeenCalledWith(2, expGainsSpeed); - }, - ); + expect(Math.pow).not.toHaveBeenCalledWith(2, expGainsSpeed); + }); }); diff --git a/test/ui/pokedex.test.ts b/test/ui/pokedex.test.ts index 6b84b253260..11dceedff12 100644 --- a/test/ui/pokedex.test.ts +++ b/test/ui/pokedex.test.ts @@ -61,6 +61,8 @@ describe("UI - Pokedex", () => { game = new GameManager(phaserGame); }); + // #region Helper Functions + /** * Run the game to open the pokedex UI. * @returns The handler for the pokedex UI. @@ -188,9 +190,8 @@ describe("UI - Pokedex", () => { } } - /*************************** - * Tests for Filters * - ***************************/ + // #endregion + // #region Filter Tests it("should filter to show only the pokemon with an ability when filtering by ability", async () => { // await game.importData("test/test-utils/saves/everything.prsv"); @@ -199,13 +200,11 @@ describe("UI - Pokedex", () => { // Get name of overgrow const overgrow = allAbilities[AbilityId.OVERGROW].name; - // @ts-expect-error `filterText` is private - pokedexHandler.filterText.setValue(FilterTextRow.ABILITY_1, overgrow); + pokedexHandler["filterText"].setValue(FilterTextRow.ABILITY_1, overgrow); // filter all species to be the pokemon that have overgrow const overgrowSpecies = getSpeciesWithAbility(AbilityId.OVERGROW); - // @ts-expect-error - `filteredPokemonData` is private - const filteredSpecies = new Set(pokedexHandler.filteredPokemonData.map(pokemon => pokemon.species.speciesId)); + const filteredSpecies = new Set(pokedexHandler["filteredPokemonData"].map(pokemon => pokemon.species.speciesId)); expect(filteredSpecies).toEqual(overgrowSpecies); }); @@ -245,14 +244,11 @@ describe("UI - Pokedex", () => { const pokedexHandler = await runToOpenPokedex(); - // @ts-expect-error `filterText` is private - pokedexHandler.filterText.setValue(FilterTextRow.ABILITY_1, ab1_instance.name); - // @ts-expect-error `filterText` is private - pokedexHandler.filterText.setValue(FilterTextRow.ABILITY_2, ab2_instance.name); + pokedexHandler["filterText"].setValue(FilterTextRow.ABILITY_1, ab1_instance.name); + pokedexHandler["filterText"].setValue(FilterTextRow.ABILITY_2, ab2_instance.name); let whiteListCount = 0; - // @ts-expect-error `filteredPokemonData` is private - for (const species of pokedexHandler.filteredPokemonData) { + for (const species of pokedexHandler["filteredPokemonData"]) { expect(blacklist, "entry must have one of the abilities as a passive").not.toContain(species.species.speciesId); const rawAbility = [species.species.ability1, species.species.ability2, species.species.abilityHidden]; @@ -273,12 +269,10 @@ describe("UI - Pokedex", () => { it("should filter to show only the pokemon with a type when filtering by a single type", async () => { const pokedexHandler = await runToOpenPokedex(); - // @ts-expect-error - `filterBar` is private - pokedexHandler.filterBar.getFilter(DropDownColumn.TYPES).toggleOptionState(PokemonType.NORMAL + 1); + pokedexHandler["filterBar"].getFilter(DropDownColumn.TYPES).toggleOptionState(PokemonType.NORMAL + 1); const expectedPokemon = getSpeciesWithType(PokemonType.NORMAL); - // @ts-expect-error - `filteredPokemonData` is private - const filteredPokemon = new Set(pokedexHandler.filteredPokemonData.map(pokemon => pokemon.species.speciesId)); + const filteredPokemon = new Set(pokedexHandler["filteredPokemonData"].map(pokemon => pokemon.species.speciesId)); expect(filteredPokemon).toEqual(expectedPokemon); }); @@ -287,14 +281,11 @@ describe("UI - Pokedex", () => { it.todo("should show only the pokemon with one of the types when filtering by multiple types", async () => { const pokedexHandler = await runToOpenPokedex(); - // @ts-expect-error - `filterBar` is private - pokedexHandler.filterBar.getFilter(DropDownColumn.TYPES).toggleOptionState(PokemonType.NORMAL + 1); - // @ts-expect-error - `filterBar` is private - pokedexHandler.filterBar.getFilter(DropDownColumn.TYPES).toggleOptionState(PokemonType.FLYING + 1); + pokedexHandler["filterBar"].getFilter(DropDownColumn.TYPES).toggleOptionState(PokemonType.NORMAL + 1); + pokedexHandler["filterBar"].getFilter(DropDownColumn.TYPES).toggleOptionState(PokemonType.FLYING + 1); const expectedPokemon = getSpeciesWithType(PokemonType.NORMAL, PokemonType.FLYING); - // @ts-expect-error - `filteredPokemonData` is private - const filteredPokemon = new Set(pokedexHandler.filteredPokemonData.map(pokemon => pokemon.species.speciesId)); + const filteredPokemon = new Set(pokedexHandler["filteredPokemonData"].map(pokemon => pokemon.species.speciesId)); expect(filteredPokemon).toEqual(expectedPokemon); }); @@ -304,8 +295,7 @@ describe("UI - Pokedex", () => { await game.importData("./test/test-utils/saves/data_pokedex_tests.prsv"); const pokedexHandler = await runToOpenPokedex(); - // @ts-expect-error - `filterBar` is private - const filter = pokedexHandler.filterBar.getFilter(DropDownColumn.UNLOCKS); + const filter = pokedexHandler["filterBar"].getFilter(DropDownColumn.UNLOCKS); // Cycling 4 times to get to the "can unlock" for cost reduction for (let i = 0; i < 4; i++) { @@ -322,8 +312,7 @@ describe("UI - Pokedex", () => { SpeciesId.MUDKIP, ]); expect( - // @ts-expect-error - `filteredPokemonData` is private - pokedexHandler.filteredPokemonData.every(pokemon => + pokedexHandler["filteredPokemonData"].every(pokemon => expectedPokemon.has(pokedexHandler.getStarterSpeciesId(pokemon.species.speciesId)), ), ).toBe(true); @@ -333,14 +322,12 @@ describe("UI - Pokedex", () => { await game.importData("./test/test-utils/saves/data_pokedex_tests.prsv"); const pokedexHandler = await runToOpenPokedex(); - // @ts-expect-error - `filterBar` is private - const filter = pokedexHandler.filterBar.getFilter(DropDownColumn.UNLOCKS); + const filter = pokedexHandler["filterBar"].getFilter(DropDownColumn.UNLOCKS); filter.toggleOptionState(0); // cycle to Passive: Yes expect( - // @ts-expect-error - `filteredPokemonData` is private - pokedexHandler.filteredPokemonData.every( + pokedexHandler["filteredPokemonData"].every( pokemon => pokedexHandler.getStarterSpeciesId(pokemon.species.speciesId) === SpeciesId.MUDKIP, ), ).toBe(true); @@ -350,8 +337,7 @@ describe("UI - Pokedex", () => { await game.importData("./test/test-utils/saves/data_pokedex_tests.prsv"); const pokedexHandler = await runToOpenPokedex(); - // @ts-expect-error - `filterBar` is private - const filter = pokedexHandler.filterBar.getFilter(DropDownColumn.UNLOCKS); + const filter = pokedexHandler["filterBar"].getFilter(DropDownColumn.UNLOCKS); // Cycling 4 times to get to the "can unlock" for passive const expectedPokemon = new Set([ @@ -367,8 +353,7 @@ describe("UI - Pokedex", () => { filter.toggleOptionState(0); expect( - // @ts-expect-error - `filteredPokemonData` is private - pokedexHandler.filteredPokemonData.every(pokemon => + pokedexHandler["filteredPokemonData"].every(pokemon => expectedPokemon.has(pokedexHandler.getStarterSpeciesId(pokemon.species.speciesId)), ), ).toBe(true); @@ -380,14 +365,12 @@ describe("UI - Pokedex", () => { const expectedPokemon = new Set([SpeciesId.TREECKO, SpeciesId.CYNDAQUIL, SpeciesId.TOTODILE]); - // @ts-expect-error - `filterBar` is private - const filter = pokedexHandler.filterBar.getFilter(DropDownColumn.UNLOCKS); + const filter = pokedexHandler["filterBar"].getFilter(DropDownColumn.UNLOCKS); // Cycle 1 time for cost reduction filter.toggleOptionState(1); expect( - // @ts-expect-error - `filteredPokemonData` is private - pokedexHandler.filteredPokemonData.every(pokemon => + pokedexHandler["filteredPokemonData"].every(pokemon => expectedPokemon.has(pokedexHandler.getStarterSpeciesId(pokemon.species.speciesId)), ), ).toBe(true); @@ -399,15 +382,13 @@ describe("UI - Pokedex", () => { const expectedPokemon = new Set([SpeciesId.CYNDAQUIL, SpeciesId.TOTODILE]); - // @ts-expect-error - `filterBar` is private - const filter = pokedexHandler.filterBar.getFilter(DropDownColumn.UNLOCKS); + const filter = pokedexHandler["filterBar"].getFilter(DropDownColumn.UNLOCKS); // Cycle 2 times for one cost reduction filter.toggleOptionState(1); filter.toggleOptionState(1); expect( - // @ts-expect-error - `filteredPokemonData` is private - pokedexHandler.filteredPokemonData.every(pokemon => + pokedexHandler["filteredPokemonData"].every(pokemon => expectedPokemon.has(pokedexHandler.getStarterSpeciesId(pokemon.species.speciesId)), ), ).toBe(true); @@ -417,16 +398,14 @@ describe("UI - Pokedex", () => { await game.importData("./test/test-utils/saves/data_pokedex_tests.prsv"); const pokedexHandler = await runToOpenPokedex(); - // @ts-expect-error - `filterBar` is private - const filter = pokedexHandler.filterBar.getFilter(DropDownColumn.UNLOCKS); + const filter = pokedexHandler["filterBar"].getFilter(DropDownColumn.UNLOCKS); // Cycle 3 time for two cost reductions filter.toggleOptionState(1); filter.toggleOptionState(1); filter.toggleOptionState(1); expect( - // @ts-expect-error - `filteredPokemonData` is private - pokedexHandler.filteredPokemonData.every( + pokedexHandler["filteredPokemonData"].every( pokemon => pokedexHandler.getStarterSpeciesId(pokemon.species.speciesId) === SpeciesId.TREECKO, ), ).toBe(true); @@ -435,12 +414,10 @@ describe("UI - Pokedex", () => { it("filtering by shiny status shows the caught pokemon with the selected shiny tier", async () => { await game.importData("./test/test-utils/saves/data_pokedex_tests.prsv"); const pokedexHandler = await runToOpenPokedex(); - // @ts-expect-error - `filterBar` is private - const filter = pokedexHandler.filterBar.getFilter(DropDownColumn.CAUGHT); + const filter = pokedexHandler["filterBar"].getFilter(DropDownColumn.CAUGHT); filter.toggleOptionState(3); - // @ts-expect-error - `filteredPokemonData` is private - let filteredPokemon = pokedexHandler.filteredPokemonData.map(pokemon => pokemon.species.speciesId); + let filteredPokemon = pokedexHandler["filteredPokemonData"].map(pokemon => pokemon.species.speciesId); // Red shiny expect(filteredPokemon.length).toBe(1); @@ -450,15 +427,13 @@ describe("UI - Pokedex", () => { filter.toggleOptionState(3); filter.toggleOptionState(2); - // @ts-expect-error - `filteredPokemonData` is private - filteredPokemon = pokedexHandler.filteredPokemonData.map(pokemon => pokemon.species.speciesId); + filteredPokemon = pokedexHandler["filteredPokemonData"].map(pokemon => pokemon.species.speciesId); expect(filteredPokemon.length).toBe(1); expect(filteredPokemon[0], "tier 2 shiny").toBe(SpeciesId.RATTATA); filter.toggleOptionState(2); filter.toggleOptionState(1); - // @ts-expect-error - `filteredPokemonData` is private - filteredPokemon = pokedexHandler.filteredPokemonData.map(pokemon => pokemon.species.speciesId); + filteredPokemon = pokedexHandler["filteredPokemonData"].map(pokemon => pokemon.species.speciesId); expect(filteredPokemon.length).toBe(1); expect(filteredPokemon[0], "tier 3 shiny").toBe(SpeciesId.EKANS); @@ -466,78 +441,66 @@ describe("UI - Pokedex", () => { filter.toggleOptionState(1); filter.toggleOptionState(4); - // @ts-expect-error - `filteredPokemonData` is private - filteredPokemon = pokedexHandler.filteredPokemonData.map(pokemon => pokemon.species.speciesId); + filteredPokemon = pokedexHandler["filteredPokemonData"].map(pokemon => pokemon.species.speciesId); expect(filteredPokemon.length).toBe(27); expect(filteredPokemon, "not shiny").not.toContain(SpeciesId.CATERPIE); expect(filteredPokemon, "not shiny").not.toContain(SpeciesId.RATTATA); expect(filteredPokemon, "not shiny").not.toContain(SpeciesId.EKANS); }); - /**************************** - * Tests for UI Input * - ****************************/ + // #endregion + // #region UI Input Tests // TODO: fix cursor wrapping - it.todo( - "should wrap the cursor to the top when moving to an empty entry when there are more than 81 pokemon", - async () => { - const pokedexHandler = await runToOpenPokedex(); + it.todo("should wrap the cursor to the top when moving to an empty entry when there are more than 81 pokemon", async () => { + const pokedexHandler = await runToOpenPokedex(); - // Filter by gen 2 so we can pan a specific amount. - // @ts-expect-error `filterBar` is private - pokedexHandler.filterBar.getFilter(DropDownColumn.GEN).options[2].toggleOptionState(); - pokedexHandler.updateStarters(); - // @ts-expect-error - `filteredPokemonData` is private - expect(pokedexHandler.filteredPokemonData.length, "pokemon in gen2").toBe(100); + // Filter by gen 2 so we can pan a specific amount. + pokedexHandler["filterBar"].getFilter(DropDownColumn.GEN).options[2].toggleOptionState(); + pokedexHandler.updateStarters(); + expect(pokedexHandler["filteredPokemonData"].length, "pokemon in gen2").toBe(100); - // Let's try to pan to the right to see what the pokemon it points to is. + // Let's try to pan to the right to see what the pokemon it points to is. - // pan to the right once and down 11 times - pokedexHandler.processInput(Button.RIGHT); - // Nab the pokemon that is selected for comparison later. + // pan to the right once and down 11 times + pokedexHandler.processInput(Button.RIGHT); + // Nab the pokemon that is selected for comparison later. - // @ts-expect-error - `lastSpecies` is private - const selectedPokemon = pokedexHandler.lastSpeciesId.speciesId; - for (let i = 0; i < 11; i++) { - pokedexHandler.processInput(Button.DOWN); - } + const selectedPokemon = pokedexHandler["lastSpeciesId"].speciesId; + for (let i = 0; i < 11; i++) { + pokedexHandler.processInput(Button.DOWN); + } - // @ts-expect-error `lastSpecies` is private - expect(selectedPokemon).toEqual(pokedexHandler.lastSpeciesId.speciesId); - }, - ); + expect(selectedPokemon).toEqual(pokedexHandler["lastSpeciesId"].speciesId); + }); - /**************************** - * Tests for Pokédex Pages * - ****************************/ + // #endregion + // #region Pokedex Pages Tests it("should show caught battle form as caught", async () => { await game.importData("./test/test-utils/saves/data_pokedex_tests_v2.prsv"); const pageHandler = await runToPokedexPage(getPokemonSpecies(SpeciesId.VENUSAUR), { form: 1 }); - // @ts-expect-error - `species` is private - expect(pageHandler.species.speciesId).toEqual(SpeciesId.VENUSAUR); + expect(pageHandler["species"].speciesId).toEqual(SpeciesId.VENUSAUR); - // @ts-expect-error - `formIndex` is private - expect(pageHandler.formIndex).toEqual(1); + expect(pageHandler["formIndex"]).toEqual(1); expect(pageHandler.isFormCaught()).toEqual(true); expect(pageHandler.isSeen()).toEqual(true); }); - //TODO: check tint of the sprite + // TODO: check tint of the sprite it("should show uncaught battle form as seen", async () => { await game.importData("./test/test-utils/saves/data_pokedex_tests_v2.prsv"); const pageHandler = await runToPokedexPage(getPokemonSpecies(SpeciesId.VENUSAUR), { form: 2 }); - // @ts-expect-error - `species` is private - expect(pageHandler.species.speciesId).toEqual(SpeciesId.VENUSAUR); + expect(pageHandler["species"].speciesId).toEqual(SpeciesId.VENUSAUR); - // @ts-expect-error - `formIndex` is private - expect(pageHandler.formIndex).toEqual(2); + expect(pageHandler["formIndex"]).toEqual(2); expect(pageHandler.isFormCaught()).toEqual(false); expect(pageHandler.isSeen()).toEqual(true); }); + + // #endregion });