[Refactor][Tests] Remove manual test timeouts (#4385)

* remove: manual timeout setting

some more sneaked in after changing the default-timeout to 20s. Possibly older PRs.

* remove: manual test timeouts from chilly reception tests
This commit is contained in:
flx-sta 2024-09-23 14:35:53 -07:00 committed by GitHub
parent 23f006bc43
commit b2b314cd68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 16 additions and 24 deletions

View File

@ -8,7 +8,6 @@ import { afterEach, beforeAll, beforeEach, describe, it, expect } from "vitest";
describe("Abilities - Arena Trap", () => { describe("Abilities - Arena Trap", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
let game: GameManager; let game: GameManager;
const TIMEOUT = 20 * 1000;
beforeAll(() => { beforeAll(() => {
phaserGame = new Phaser.Game({ phaserGame = new Phaser.Game({
@ -43,7 +42,7 @@ describe("Abilities - Arena Trap", () => {
await game.toNextTurn(); await game.toNextTurn();
expect(enemy).toBe(game.scene.getEnemyPokemon()); expect(enemy).toBe(game.scene.getEnemyPokemon());
}, TIMEOUT); });
it("should guarantee double battle with any one LURE", async () => { it("should guarantee double battle with any one LURE", async () => {
game.override game.override
@ -55,5 +54,5 @@ describe("Abilities - Arena Trap", () => {
await game.classicMode.startBattle(); await game.classicMode.startBattle();
expect(game.scene.getEnemyField().length).toBe(2); expect(game.scene.getEnemyField().length).toBe(2);
}, TIMEOUT); });
}); });

View File

@ -8,7 +8,6 @@ import { afterEach, beforeAll, beforeEach, describe, it, expect } from "vitest";
describe("Abilities - Illuminate", () => { describe("Abilities - Illuminate", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
let game: GameManager; let game: GameManager;
const TIMEOUT = 20 * 1000;
beforeAll(() => { beforeAll(() => {
phaserGame = new Phaser.Game({ phaserGame = new Phaser.Game({
@ -43,7 +42,7 @@ describe("Abilities - Illuminate", () => {
await game.toNextTurn(); await game.toNextTurn();
expect(player.getStatStage(Stat.ACC)).toBe(0); expect(player.getStatStage(Stat.ACC)).toBe(0);
}, TIMEOUT); });
it("should guarantee double battle with any one LURE", async () => { it("should guarantee double battle with any one LURE", async () => {
game.override game.override
@ -55,5 +54,5 @@ describe("Abilities - Illuminate", () => {
await game.classicMode.startBattle(); await game.classicMode.startBattle();
expect(game.scene.getEnemyField().length).toBe(2); expect(game.scene.getEnemyField().length).toBe(2);
}, TIMEOUT); });
}); });

View File

@ -11,7 +11,6 @@ import { afterEach, beforeAll, beforeEach, describe, it, expect, vi } from "vite
describe("Abilities - No Guard", () => { describe("Abilities - No Guard", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
let game: GameManager; let game: GameManager;
const TIMEOUT = 20 * 1000;
beforeAll(() => { beforeAll(() => {
phaserGame = new Phaser.Game({ phaserGame = new Phaser.Game({
@ -52,7 +51,7 @@ describe("Abilities - No Guard", () => {
await game.phaseInterceptor.to(MoveEndPhase); await game.phaseInterceptor.to(MoveEndPhase);
expect(moveEffectPhase.hitCheck).toHaveReturnedWith(true); expect(moveEffectPhase.hitCheck).toHaveReturnedWith(true);
}, TIMEOUT); });
it("should guarantee double battle with any one LURE", async () => { it("should guarantee double battle with any one LURE", async () => {
game.override game.override
@ -64,5 +63,5 @@ describe("Abilities - No Guard", () => {
await game.classicMode.startBattle(); await game.classicMode.startBattle();
expect(game.scene.getEnemyField().length).toBe(2); expect(game.scene.getEnemyField().length).toBe(2);
}, TIMEOUT); });
}); });

View File

@ -6,8 +6,6 @@ import GameManager from "#test/utils/gameManager";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
const TIMEOUT = 20 * 1000;
describe("Moves - Chilly Reception", () => { describe("Moves - Chilly Reception", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
let game: GameManager; let game: GameManager;
@ -39,7 +37,7 @@ describe("Moves - Chilly Reception", () => {
await game.phaseInterceptor.to("BerryPhase", false); await game.phaseInterceptor.to("BerryPhase", false);
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW); expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
}, TIMEOUT); });
it("should switch out even if it's snowing", async () => { it("should switch out even if it's snowing", async () => {
await game.classicMode.startBattle([Species.SLOWKING, Species.MEOWTH]); await game.classicMode.startBattle([Species.SLOWKING, Species.MEOWTH]);
@ -55,7 +53,7 @@ describe("Moves - Chilly Reception", () => {
await game.phaseInterceptor.to("BerryPhase", false); await game.phaseInterceptor.to("BerryPhase", false);
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW); expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
expect(game.scene.getPlayerField()[0].species.speciesId).toBe(Species.MEOWTH); expect(game.scene.getPlayerField()[0].species.speciesId).toBe(Species.MEOWTH);
}, TIMEOUT); });
it("happy case - switch out and weather changes", async () => { it("happy case - switch out and weather changes", async () => {
@ -67,5 +65,5 @@ describe("Moves - Chilly Reception", () => {
await game.phaseInterceptor.to("BerryPhase", false); await game.phaseInterceptor.to("BerryPhase", false);
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW); expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
expect(game.scene.getPlayerField()[0].species.speciesId).toBe(Species.MEOWTH); expect(game.scene.getPlayerField()[0].species.speciesId).toBe(Species.MEOWTH);
}, TIMEOUT); });
}); });

View File

@ -10,8 +10,6 @@ import { Species } from "#enums/species";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
const TIMEOUT = 20 * 1000;
// Bulbapedia Reference: https://bulbapedia.bulbagarden.net/wiki/Heal_Block_(move) // Bulbapedia Reference: https://bulbapedia.bulbagarden.net/wiki/Heal_Block_(move)
describe("Moves - Heal Block", () => { describe("Moves - Heal Block", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -53,8 +51,7 @@ describe("Moves - Heal Block", () => {
expect(player.hp).toBe(1); expect(player.hp).toBe(1);
expect(enemy.hp).toBeLessThan(enemy.getMaxHp()); expect(enemy.hp).toBeLessThan(enemy.getMaxHp());
}, TIMEOUT });
);
it("shouldn't stop Liquid Ooze from dealing damage", async() => { it("shouldn't stop Liquid Ooze from dealing damage", async() => {
game.override.enemyAbility(Abilities.LIQUID_OOZE); game.override.enemyAbility(Abilities.LIQUID_OOZE);
@ -70,7 +67,7 @@ describe("Moves - Heal Block", () => {
expect(player.isFullHp()).toBe(false); expect(player.isFullHp()).toBe(false);
expect(enemy.isFullHp()).toBe(false); expect(enemy.isFullHp()).toBe(false);
}, TIMEOUT); });
it("should stop delayed heals, such as from Wish", async() => { it("should stop delayed heals, such as from Wish", async() => {
await game.classicMode.startBattle([Species.CHARIZARD]); await game.classicMode.startBattle([Species.CHARIZARD]);
@ -89,7 +86,7 @@ describe("Moves - Heal Block", () => {
} }
expect(player.hp).toBe(1); expect(player.hp).toBe(1);
}, TIMEOUT); });
it("should prevent Grassy Terrain from restoring HP", async() => { it("should prevent Grassy Terrain from restoring HP", async() => {
game.override.enemyAbility(Abilities.GRASSY_SURGE); game.override.enemyAbility(Abilities.GRASSY_SURGE);
@ -104,7 +101,7 @@ describe("Moves - Heal Block", () => {
await game.phaseInterceptor.to("TurnEndPhase"); await game.phaseInterceptor.to("TurnEndPhase");
expect(player.hp).toBe(1); expect(player.hp).toBe(1);
}, TIMEOUT); });
it("should prevent healing from heal-over-time moves", async() => { it("should prevent healing from heal-over-time moves", async() => {
await game.classicMode.startBattle([Species.CHARIZARD]); await game.classicMode.startBattle([Species.CHARIZARD]);
@ -118,7 +115,7 @@ describe("Moves - Heal Block", () => {
expect(player.getTag(BattlerTagType.AQUA_RING)).toBeDefined(); expect(player.getTag(BattlerTagType.AQUA_RING)).toBeDefined();
expect(player.hp).toBe(1); expect(player.hp).toBe(1);
}, TIMEOUT); });
it("should prevent abilities from restoring HP", async() => { it("should prevent abilities from restoring HP", async() => {
game.override game.override
@ -135,7 +132,7 @@ describe("Moves - Heal Block", () => {
await game.phaseInterceptor.to("TurnEndPhase"); await game.phaseInterceptor.to("TurnEndPhase");
expect(player.hp).toBe(1); expect(player.hp).toBe(1);
}, TIMEOUT); });
it("should stop healing from items", async() => { it("should stop healing from items", async() => {
game.override.startingHeldItems([{name: "LEFTOVERS"}]); game.override.startingHeldItems([{name: "LEFTOVERS"}]);
@ -149,5 +146,5 @@ describe("Moves - Heal Block", () => {
await game.phaseInterceptor.to("TurnEndPhase"); await game.phaseInterceptor.to("TurnEndPhase");
expect(player.hp).toBe(1); expect(player.hp).toBe(1);
}, TIMEOUT); });
}); });