[Dev] Update Biome from 2.3.2 to 2.3.8 (#6799)

* Update Biome to `2.3.8` and run Biome over the repo

* Update comment in `biome.jsonc`
This commit is contained in:
NightKev 2025-11-29 16:39:58 -06:00 committed by GitHub
parent 9bfe5f02d8
commit b6bd9566e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 303 additions and 360 deletions

View File

@ -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": {

View File

@ -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",

View File

@ -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': {}

View File

@ -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 },

View File

@ -49,9 +49,7 @@ 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 () => {
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]);
@ -67,7 +65,5 @@ describe("Abilities - Moxie", () => {
await game.phaseInterceptor.to("TurnEndPhase");
expect(firstPokemon.getStatStage(Stat.ATK)).toBe(1);
},
20000,
);
}, 20000);
});

View File

@ -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 },

View File

@ -35,9 +35,8 @@ 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 => {
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,
@ -60,8 +59,7 @@ describe("Abilities - Shields Down", () => {
await game.toNextTurn();
expect(minior.formIndex).toBe(meteorIndex);
},
);
});
it("should revert to base form on arena reset, even when fainted", async () => {
game.override.startingWave(4).starterForms({

View File

@ -79,9 +79,7 @@ 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 () => {
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);
@ -90,6 +88,5 @@ describe.each<{ name: string; ability: AbilityId; status: StatusEffect }>([
const karp = game.field.getEnemyPokemon();
expect(karp.status?.effect).toBeUndefined();
expect(game.field.getPlayerPokemon().getLastXMoves()[0].result).toBe(MoveResult.FAIL);
},
);
});
});

View File

@ -199,9 +199,7 @@ 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 () => {
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])
@ -220,8 +218,7 @@ describe("Abilities - Wimp Out", () => {
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,9 +457,7 @@ 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 () => {
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();
@ -478,8 +473,7 @@ describe("Abilities - Wimp Out", () => {
}
confirmNoSwitch();
},
);
});
it("should not activate on wave X0 bosses", async () => {
game.override.enemyAbility(AbilityId.WIMP_OUT).startingLevel(5850).startingWave(10);

View File

@ -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 }) => {

View File

@ -199,9 +199,8 @@ 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 => {
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]);
@ -210,8 +209,7 @@ describe("Spec - Pokemon", () => {
expect(iv).toBeGreaterThanOrEqual(Math.floor(wave / 10));
}
}
},
);
});
it.each([
{ wave: 5, friendship: 6 },

View File

@ -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 },

View File

@ -219,9 +219,7 @@ 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 () => {
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]);
@ -241,8 +239,7 @@ describe("Moves - Magic Coat", () => {
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);

View File

@ -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" },

View File

@ -60,10 +60,8 @@ 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 () => {
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,
@ -106,13 +104,10 @@ describe("Moves - Parting Shot", () => {
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 () => {
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]);
@ -125,13 +120,10 @@ describe("Moves - Parting Shot", () => {
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 () => {
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]);
@ -144,13 +136,10 @@ describe("Moves - Parting Shot", () => {
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 () => {
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];
@ -167,6 +156,5 @@ describe("Moves - Parting Shot", () => {
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(0);
expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(0);
expect(game.field.getPlayerPokemon().species.speciesId).toBe(SpeciesId.MURKROW);
},
);
});
});

View File

@ -38,9 +38,11 @@ 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 => {
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");
@ -51,6 +53,5 @@ describe("UI - Battle Info", () => {
await game.phaseInterceptor.to(ExpPhase, true);
expect(Math.pow).not.toHaveBeenCalledWith(2, expGainsSpeed);
},
);
});
});

View File

@ -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,30 +441,24 @@ 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 () => {
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["filterBar"].getFilter(DropDownColumn.GEN).options[2].toggleOptionState();
pokedexHandler.updateStarters();
// @ts-expect-error - `filteredPokemonData` is private
expect(pokedexHandler.filteredPokemonData.length, "pokemon in gen2").toBe(100);
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.
@ -497,30 +466,24 @@ describe("UI - Pokedex", () => {
pokedexHandler.processInput(Button.RIGHT);
// Nab the pokemon that is selected for comparison later.
// @ts-expect-error - `lastSpecies` is private
const selectedPokemon = pokedexHandler.lastSpeciesId.speciesId;
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);
@ -531,13 +494,13 @@ describe("UI - Pokedex", () => {
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
});