mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-26 08:46:55 +00:00
[Bug][Unit Test] fix and optimize sturdy unit tests (#2455)
* fix and optimize sturdy unit tests * re-add timeout
This commit is contained in:
parent
73cf89474d
commit
d3e516b496
@ -3,7 +3,8 @@ import Phaser from "phaser";
|
|||||||
import GameManager from "#app/test/utils/gameManager";
|
import GameManager from "#app/test/utils/gameManager";
|
||||||
import * as overrides from "#app/overrides";
|
import * as overrides from "#app/overrides";
|
||||||
import {
|
import {
|
||||||
TurnEndPhase,
|
DamagePhase,
|
||||||
|
MoveEndPhase,
|
||||||
} from "#app/phases";
|
} from "#app/phases";
|
||||||
import {getMovePosition} from "#app/test/utils/gameManagerUtils";
|
import {getMovePosition} from "#app/test/utils/gameManagerUtils";
|
||||||
import { Abilities } from "#enums/abilities";
|
import { Abilities } from "#enums/abilities";
|
||||||
@ -45,7 +46,7 @@ describe("Abilities - Sturdy", () => {
|
|||||||
async () => {
|
async () => {
|
||||||
await game.startBattle();
|
await game.startBattle();
|
||||||
game.doAttack(getMovePosition(game.scene, 0, Moves.CLOSE_COMBAT));
|
game.doAttack(getMovePosition(game.scene, 0, Moves.CLOSE_COMBAT));
|
||||||
await game.phaseInterceptor.to(TurnEndPhase);
|
await game.phaseInterceptor.to(MoveEndPhase);
|
||||||
expect(game.scene.getEnemyParty()[0].hp).toBe(1);
|
expect(game.scene.getEnemyParty()[0].hp).toBe(1);
|
||||||
},
|
},
|
||||||
TIMEOUT
|
TIMEOUT
|
||||||
@ -55,10 +56,13 @@ describe("Abilities - Sturdy", () => {
|
|||||||
"Sturdy doesn't activate when user is not at full HP",
|
"Sturdy doesn't activate when user is not at full HP",
|
||||||
async () => {
|
async () => {
|
||||||
await game.startBattle();
|
await game.startBattle();
|
||||||
|
|
||||||
const enemyPokemon: EnemyPokemon = game.scene.getEnemyParty()[0];
|
const enemyPokemon: EnemyPokemon = game.scene.getEnemyParty()[0];
|
||||||
enemyPokemon.hp = enemyPokemon.getMaxHp() - 1;
|
enemyPokemon.hp = enemyPokemon.getMaxHp() - 1;
|
||||||
|
|
||||||
game.doAttack(getMovePosition(game.scene, 0, Moves.CLOSE_COMBAT));
|
game.doAttack(getMovePosition(game.scene, 0, Moves.CLOSE_COMBAT));
|
||||||
await game.phaseInterceptor.to(TurnEndPhase);
|
await game.phaseInterceptor.to(DamagePhase);
|
||||||
|
|
||||||
expect(enemyPokemon.hp).toBe(0);
|
expect(enemyPokemon.hp).toBe(0);
|
||||||
expect(enemyPokemon.isFainted()).toBe(true);
|
expect(enemyPokemon.isFainted()).toBe(true);
|
||||||
},
|
},
|
||||||
@ -66,11 +70,12 @@ describe("Abilities - Sturdy", () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
test(
|
test(
|
||||||
"Sturdy pokemon should be inmune to OHKO moves",
|
"Sturdy pokemon should be immune to OHKO moves",
|
||||||
async () => {
|
async () => {
|
||||||
await game.startBattle();
|
await game.startBattle();
|
||||||
game.doAttack(getMovePosition(game.scene, 0, Moves.FISSURE));
|
game.doAttack(getMovePosition(game.scene, 0, Moves.FISSURE));
|
||||||
await game.phaseInterceptor.to(TurnEndPhase);
|
await game.phaseInterceptor.to(MoveEndPhase);
|
||||||
|
|
||||||
const enemyPokemon: EnemyPokemon = game.scene.getEnemyParty()[0];
|
const enemyPokemon: EnemyPokemon = game.scene.getEnemyParty()[0];
|
||||||
expect(enemyPokemon.hp).toBe(enemyPokemon.getMaxHp());
|
expect(enemyPokemon.hp).toBe(enemyPokemon.getMaxHp());
|
||||||
},
|
},
|
||||||
@ -84,7 +89,8 @@ describe("Abilities - Sturdy", () => {
|
|||||||
|
|
||||||
await game.startBattle();
|
await game.startBattle();
|
||||||
game.doAttack(getMovePosition(game.scene, 0, Moves.CLOSE_COMBAT));
|
game.doAttack(getMovePosition(game.scene, 0, Moves.CLOSE_COMBAT));
|
||||||
await game.phaseInterceptor.to(TurnEndPhase);
|
await game.phaseInterceptor.to(DamagePhase);
|
||||||
|
|
||||||
const enemyPokemon: EnemyPokemon = game.scene.getEnemyParty()[0];
|
const enemyPokemon: EnemyPokemon = game.scene.getEnemyParty()[0];
|
||||||
expect(enemyPokemon.hp).toBe(0);
|
expect(enemyPokemon.hp).toBe(0);
|
||||||
expect(enemyPokemon.isFainted()).toBe(true);
|
expect(enemyPokemon.isFainted()).toBe(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user