From 4796852bc39a9a7f34f96507d76030e6e9775053 Mon Sep 17 00:00:00 2001 From: Bertie690 Date: Wed, 30 Apr 2025 15:52:28 -0400 Subject: [PATCH] Removed cases of `expect(xxx === y).toBeTruthy()` just use `expect.toBe()`, it looks better and actually tells you stuff --- test/moves/baneful_bunker.test.ts | 4 +- test/moves/roost.test.ts | 58 +++++++++---------- .../a-trainers-test-encounter.test.ts | 2 +- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/test/moves/baneful_bunker.test.ts b/test/moves/baneful_bunker.test.ts index 90a7a62f023..3e4c950d7d4 100644 --- a/test/moves/baneful_bunker.test.ts +++ b/test/moves/baneful_bunker.test.ts @@ -43,7 +43,7 @@ describe("Moves - Baneful Bunker", () => { await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]); await game.phaseInterceptor.to("BerryPhase", false); expect(enemyPokemon.hp).toBe(enemyPokemon.getMaxHp()); - expect(leadPokemon.status?.effect === StatusEffect.POISON).toBeTruthy(); + expect(leadPokemon.status?.effect).toBe(StatusEffect.POISON); }); test("should protect the user and poison attackers that make contact, regardless of accuracy checks", async () => { await game.classicMode.startBattle([Species.CHARIZARD]); @@ -58,7 +58,7 @@ describe("Moves - Baneful Bunker", () => { await game.move.forceMiss(); await game.phaseInterceptor.to("BerryPhase", false); expect(enemyPokemon.hp).toBe(enemyPokemon.getMaxHp()); - expect(leadPokemon.status?.effect === StatusEffect.POISON).toBeTruthy(); + expect(leadPokemon.status?.effect).toBe(StatusEffect.POISON); }); test("should not poison attackers that don't make contact", async () => { diff --git a/test/moves/roost.test.ts b/test/moves/roost.test.ts index ef9c2693f60..81248895444 100644 --- a/test/moves/roost.test.ts +++ b/test/moves/roost.test.ts @@ -57,8 +57,8 @@ describe("Moves - Roost", () => { // Should only be normal type, and NOT flying type let playerPokemonTypes = playerPokemon.getTypes(); - expect(playerPokemonTypes[0] === PokemonType.NORMAL).toBeTruthy(); - expect(playerPokemonTypes.length === 1).toBeTruthy(); + expect(playerPokemonTypes[0]).toBe(PokemonType.NORMAL); + expect(playerPokemonTypes.length).toBe(1); expect(playerPokemon.isGrounded()).toBeTruthy(); await game.phaseInterceptor.to(TurnEndPhase); @@ -66,8 +66,8 @@ describe("Moves - Roost", () => { // Lose HP, still normal type playerPokemonTypes = playerPokemon.getTypes(); expect(playerPokemon.hp).toBeLessThan(playerPokemonStartingHP); - expect(playerPokemonTypes[0] === PokemonType.NORMAL).toBeTruthy(); - expect(playerPokemonTypes.length === 1).toBeTruthy(); + expect(playerPokemonTypes[0]).toBe(PokemonType.NORMAL); + expect(playerPokemonTypes.length).toBe(1); expect(playerPokemon.isGrounded()).toBeTruthy(); }); @@ -81,7 +81,7 @@ describe("Moves - Roost", () => { // Should only be normal type, and NOT flying type let playerPokemonTypes = playerPokemon.getTypes(); - expect(playerPokemonTypes[0] === PokemonType.NORMAL).toBeTruthy(); + expect(playerPokemonTypes[0]).toBe(PokemonType.NORMAL); expect(playerPokemonTypes[0] === PokemonType.FLYING).toBeFalsy(); expect(playerPokemon.isGrounded()).toBeTruthy(); @@ -91,7 +91,7 @@ describe("Moves - Roost", () => { playerPokemonTypes = playerPokemon.getTypes(); expect(playerPokemon.hp).toBeLessThan(playerPokemonStartingHP); expect(playerPokemonTypes[0] === PokemonType.NORMAL).toBeFalsy(); - expect(playerPokemonTypes[0] === PokemonType.FLYING).toBeTruthy(); + expect(playerPokemonTypes[0]).toBe(PokemonType.FLYING); expect(playerPokemon.isGrounded()).toBeFalsy(); }); @@ -105,8 +105,8 @@ describe("Moves - Roost", () => { // Should only be pure fighting type and grounded let playerPokemonTypes = playerPokemon.getTypes(); - expect(playerPokemonTypes[0] === PokemonType.FIGHTING).toBeTruthy(); - expect(playerPokemonTypes.length === 1).toBeTruthy(); + expect(playerPokemonTypes[0]).toBe(PokemonType.FIGHTING); + expect(playerPokemonTypes.length).toBe(1); expect(playerPokemon.isGrounded()).toBeTruthy(); await game.phaseInterceptor.to(TurnEndPhase); @@ -114,8 +114,8 @@ describe("Moves - Roost", () => { // Should have lost HP and is now back to being fighting/flying playerPokemonTypes = playerPokemon.getTypes(); expect(playerPokemon.hp).toBeLessThan(playerPokemonStartingHP); - expect(playerPokemonTypes[0] === PokemonType.FIGHTING).toBeTruthy(); - expect(playerPokemonTypes[1] === PokemonType.FLYING).toBeTruthy(); + expect(playerPokemonTypes[0]).toBe(PokemonType.FIGHTING); + expect(playerPokemonTypes[1]).toBe(PokemonType.FLYING); expect(playerPokemon.isGrounded()).toBeFalsy(); }); @@ -130,8 +130,8 @@ describe("Moves - Roost", () => { // Should only be pure eletric type and grounded let playerPokemonTypes = playerPokemon.getTypes(); - expect(playerPokemonTypes[0] === PokemonType.ELECTRIC).toBeTruthy(); - expect(playerPokemonTypes.length === 1).toBeTruthy(); + expect(playerPokemonTypes[0]).toBe(PokemonType.ELECTRIC); + expect(playerPokemonTypes.length).toBe(1); expect(playerPokemon.isGrounded()).toBeFalsy(); await game.phaseInterceptor.to(TurnEndPhase); @@ -139,8 +139,8 @@ describe("Moves - Roost", () => { // Should have lost HP and is now back to being electric/flying playerPokemonTypes = playerPokemon.getTypes(); expect(playerPokemon.hp).toBe(playerPokemonStartingHP); - expect(playerPokemonTypes[0] === PokemonType.ELECTRIC).toBeTruthy(); - expect(playerPokemonTypes[1] === PokemonType.FLYING).toBeTruthy(); + expect(playerPokemonTypes[0]).toBe(PokemonType.ELECTRIC); + expect(playerPokemonTypes[1]).toBe(PokemonType.FLYING); expect(playerPokemon.isGrounded()).toBeFalsy(); }); @@ -154,8 +154,8 @@ describe("Moves - Roost", () => { // Should only be pure flying type after burn up let playerPokemonTypes = playerPokemon.getTypes(); - expect(playerPokemonTypes[0] === PokemonType.FLYING).toBeTruthy(); - expect(playerPokemonTypes.length === 1).toBeTruthy(); + expect(playerPokemonTypes[0]).toBe(PokemonType.FLYING); + expect(playerPokemonTypes.length).toBe(1); await game.phaseInterceptor.to(TurnEndPhase); game.move.select(Moves.ROOST); @@ -165,8 +165,8 @@ describe("Moves - Roost", () => { // Should only be typeless type after roost and is grounded playerPokemonTypes = playerPokemon.getTypes(); expect(playerPokemon.getTag(BattlerTagType.ROOSTED)).toBeDefined(); - expect(playerPokemonTypes[0] === PokemonType.UNKNOWN).toBeTruthy(); - expect(playerPokemonTypes.length === 1).toBeTruthy(); + expect(playerPokemonTypes[0]).toBe(PokemonType.UNKNOWN); + expect(playerPokemonTypes.length).toBe(1); expect(playerPokemon.isGrounded()).toBeTruthy(); await game.phaseInterceptor.to(TurnEndPhase); @@ -174,8 +174,8 @@ describe("Moves - Roost", () => { // Should go back to being pure flying and have taken damage from earthquake, and is ungrounded again playerPokemonTypes = playerPokemon.getTypes(); expect(playerPokemon.hp).toBeLessThan(playerPokemonStartingHP); - expect(playerPokemonTypes[0] === PokemonType.FLYING).toBeTruthy(); - expect(playerPokemonTypes.length === 1).toBeTruthy(); + expect(playerPokemonTypes[0]).toBe(PokemonType.FLYING); + expect(playerPokemonTypes.length).toBe(1); expect(playerPokemon.isGrounded()).toBeFalsy(); }); @@ -190,8 +190,8 @@ describe("Moves - Roost", () => { // Should only be pure flying type after burn up let playerPokemonTypes = playerPokemon.getTypes(); - expect(playerPokemonTypes[0] === PokemonType.FLYING).toBeTruthy(); - expect(playerPokemonTypes.length === 1).toBeTruthy(); + expect(playerPokemonTypes[0]).toBe(PokemonType.FLYING); + expect(playerPokemonTypes.length).toBe(1); await game.phaseInterceptor.to(TurnEndPhase); game.move.select(Moves.ROOST); @@ -201,8 +201,8 @@ describe("Moves - Roost", () => { // Should only be typeless type after roost and is grounded playerPokemonTypes = playerPokemon.getTypes(); expect(playerPokemon.getTag(BattlerTagType.ROOSTED)).toBeDefined(); - expect(playerPokemonTypes[0] === PokemonType.UNKNOWN).toBeTruthy(); - expect(playerPokemonTypes.length === 1).toBeTruthy(); + expect(playerPokemonTypes[0]).toBe(PokemonType.UNKNOWN); + expect(playerPokemonTypes.length).toBe(1); expect(playerPokemon.isGrounded()).toBeTruthy(); await game.phaseInterceptor.to(TurnEndPhase); @@ -210,8 +210,8 @@ describe("Moves - Roost", () => { // Should go back to being pure flying and have taken damage from earthquake, and is ungrounded again playerPokemonTypes = playerPokemon.getTypes(); expect(playerPokemon.hp).toBeLessThan(playerPokemonStartingHP); - expect(playerPokemonTypes[0] === PokemonType.FLYING).toBeTruthy(); - expect(playerPokemonTypes.length === 1).toBeTruthy(); + expect(playerPokemonTypes[0]).toBe(PokemonType.FLYING); + expect(playerPokemonTypes.length).toBe(1); expect(playerPokemon.isGrounded()).toBeFalsy(); }); @@ -228,8 +228,8 @@ describe("Moves - Roost", () => { await game.phaseInterceptor.to(MoveEffectPhase); let playerPokemonTypes = playerPokemon.getTypes(); - expect(playerPokemonTypes[0] === PokemonType.FIRE).toBeTruthy(); - expect(playerPokemonTypes.length === 1).toBeTruthy(); + expect(playerPokemonTypes[0]).toBe(PokemonType.FIRE); + expect(playerPokemonTypes.length).toBe(1); expect(playerPokemon.isGrounded()).toBeTruthy(); await game.phaseInterceptor.to(TurnEndPhase); @@ -239,7 +239,7 @@ describe("Moves - Roost", () => { expect(playerPokemonTypes.filter(type => type === PokemonType.FLYING)).toHaveLength(1); expect(playerPokemonTypes.filter(type => type === PokemonType.FIRE)).toHaveLength(1); expect(playerPokemonTypes.filter(type => type === PokemonType.GHOST)).toHaveLength(1); - expect(playerPokemonTypes.length === 3).toBeTruthy(); + expect(playerPokemonTypes.length).toBe(3); expect(playerPokemon.isGrounded()).toBeFalsy(); }); }); diff --git a/test/mystery-encounter/encounters/a-trainers-test-encounter.test.ts b/test/mystery-encounter/encounters/a-trainers-test-encounter.test.ts index 33099034c4d..823dec0b5fa 100644 --- a/test/mystery-encounter/encounters/a-trainers-test-encounter.test.ts +++ b/test/mystery-encounter/encounters/a-trainers-test-encounter.test.ts @@ -137,7 +137,7 @@ describe("A Trainer's Test - Mystery Encounter", () => { expect(eggsAfter).toBeDefined(); expect(eggsBeforeLength + 1).toBe(eggsAfter.length); const eggTier = eggsAfter[eggsAfter.length - 1].tier; - expect(eggTier === EggTier.EPIC || eggTier === EggTier.LEGENDARY).toBeTruthy(); + expect(eggTier).toBe(EggTier.EPIC || eggTier === EggTier.LEGENDARY); }); });