mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-08 00:19:29 +02:00
* Partially ported over pkty matchers (WIP) * Cleaned up some more matchers * Fiexd up matchers * Fixed up remaining matchers * Removed the word "matcher" from the pkty matcher functions If we want them back we can always undo this commit and convert the other custom ones * Added wip spite test * Added `toHaveUsedPP` matcher * Fixed up docs and tests * Fixed spite test * Ran biome * Apply Biome * Reverted biome breaking i18next * Update src/typings/i18next.d.ts comment * Fixed log message to not be overly verbose * Added option to check for all PP used in pp matcher + cleaned up grudge tests * Fixed up tests * Fixed tests and such * Fix various TSDocs + missing TSDoc imports
140 lines
6.3 KiB
TypeScript
140 lines
6.3 KiB
TypeScript
import type { TerrainType } from "#app/data/terrain";
|
|
import type { AbilityId } from "#enums/ability-id";
|
|
import type { BattlerTagType } from "#enums/battler-tag-type";
|
|
import type { MoveId } from "#enums/move-id";
|
|
import type { PokemonType } from "#enums/pokemon-type";
|
|
import type { BattleStat, EffectiveStat, Stat } from "#enums/stat";
|
|
import type { StatusEffect } from "#enums/status-effect";
|
|
import type { WeatherType } from "#enums/weather-type";
|
|
import type { Pokemon } from "#field/pokemon";
|
|
import type { ToHaveEffectiveStatMatcherOptions } from "#test/test-utils/matchers/to-have-effective-stat";
|
|
import type { expectedStatusType } from "#test/test-utils/matchers/to-have-status-effect";
|
|
import type { toHaveTypesOptions } from "#test/test-utils/matchers/to-have-types";
|
|
import type { TurnMove } from "#types/turn-move";
|
|
import type { AtLeastOne } from "#types/type-helpers";
|
|
import type { expect } from "vitest";
|
|
import type Overrides from "#app/overrides";
|
|
import type { PokemonMove } from "#moves/pokemon-move";
|
|
|
|
declare module "vitest" {
|
|
interface Assertion {
|
|
/**
|
|
* Check whether an array contains EXACTLY the given items (in any order).
|
|
*
|
|
* Different from {@linkcode expect.arrayContaining} as the latter only checks for subset equality
|
|
* (as opposed to full equality).
|
|
*
|
|
* @param expected - The expected contents of the array, in any order
|
|
* @see {@linkcode expect.arrayContaining}
|
|
*/
|
|
toEqualArrayUnsorted<E>(expected: E[]): void;
|
|
|
|
/**
|
|
* Check whether a {@linkcode Pokemon}'s current typing includes the given types.
|
|
*
|
|
* @param expected - The expected types (in any order)
|
|
* @param options - The options passed to the matcher
|
|
*/
|
|
toHaveTypes(expected: [PokemonType, ...PokemonType[]], options?: toHaveTypesOptions): void;
|
|
|
|
/**
|
|
* Matcher to check the contents of a {@linkcode Pokemon}'s move history.
|
|
*
|
|
* @param expectedValue - The expected value; can be a {@linkcode MoveId} or a partially filled {@linkcode TurnMove}
|
|
* containing the desired properties to check
|
|
* @param index - The index of the move history entry to check, in order from most recent to least recent.
|
|
* Default `0` (last used move)
|
|
* @see {@linkcode Pokemon.getLastXMoves}
|
|
*/
|
|
toHaveUsedMove(expected: MoveId | AtLeastOne<TurnMove>, index?: number): void;
|
|
|
|
/**
|
|
* Check whether a {@linkcode Pokemon}'s effective stat is as expected
|
|
* (checked after all stat value modifications).
|
|
*
|
|
* @param stat - The {@linkcode EffectiveStat} to check
|
|
* @param expectedValue - The expected value of {@linkcode stat}
|
|
* @param options - (Optional) The {@linkcode ToHaveEffectiveStatMatcherOptions}
|
|
* @remarks
|
|
* If you want to check the stat **before** modifiers are applied, use {@linkcode Pokemon.getStat} instead.
|
|
*/
|
|
toHaveEffectiveStat(stat: EffectiveStat, expectedValue: number, options?: ToHaveEffectiveStatMatcherOptions): void;
|
|
|
|
/**
|
|
* Check whether a {@linkcode Pokemon} has taken a specific amount of damage.
|
|
* @param expectedDamageTaken - The expected amount of damage taken
|
|
* @param roundDown - Whether to round down {@linkcode expectedDamageTaken} with {@linkcode toDmgValue}; default `true`
|
|
*/
|
|
toHaveTakenDamage(expectedDamageTaken: number, roundDown?: boolean): void;
|
|
|
|
/**
|
|
* Check whether the current {@linkcode WeatherType} is as expected.
|
|
* @param expectedWeatherType - The expected {@linkcode WeatherType}
|
|
*/
|
|
toHaveWeather(expectedWeatherType: WeatherType): void;
|
|
|
|
/**
|
|
* Check whether the current {@linkcode TerrainType} is as expected.
|
|
* @param expectedTerrainType - The expected {@linkcode TerrainType}
|
|
*/
|
|
toHaveTerrain(expectedTerrainType: TerrainType): void;
|
|
|
|
/**
|
|
* Check whether a {@linkcode Pokemon} is at full HP.
|
|
*/
|
|
toHaveFullHp(): void;
|
|
|
|
/**
|
|
* Check whether a {@linkcode Pokemon} has a specific {@linkcode StatusEffect | non-volatile status effect}.
|
|
* @param expectedStatusEffect - The {@linkcode StatusEffect} the Pokemon is expected to have,
|
|
* or a partially filled {@linkcode Status} containing the desired properties
|
|
*/
|
|
toHaveStatusEffect(expectedStatusEffect: expectedStatusType): void;
|
|
|
|
/**
|
|
* Check whether a {@linkcode Pokemon} has a specific {@linkcode Stat} stage.
|
|
* @param stat - The {@linkcode BattleStat} to check
|
|
* @param expectedStage - The expected stat stage value of {@linkcode stat}
|
|
*/
|
|
toHaveStatStage(stat: BattleStat, expectedStage: number): void;
|
|
|
|
/**
|
|
* Check whether a {@linkcode Pokemon} has a specific {@linkcode BattlerTagType}.
|
|
* @param expectedBattlerTagType - The expected {@linkcode BattlerTagType}
|
|
*/
|
|
toHaveBattlerTag(expectedBattlerTagType: BattlerTagType): void;
|
|
|
|
/**
|
|
* Check whether a {@linkcode Pokemon} has applied a specific {@linkcode AbilityId}.
|
|
* @param expectedAbilityId - The expected {@linkcode AbilityId}
|
|
*/
|
|
toHaveAbilityApplied(expectedAbilityId: AbilityId): void;
|
|
|
|
/**
|
|
* Check whether a {@linkcode Pokemon} has a specific amount of {@linkcode Stat.HP | HP}.
|
|
* @param expectedHp - The expected amount of {@linkcode Stat.HP | HP} to have
|
|
*/
|
|
toHaveHp(expectedHp: number): void;
|
|
|
|
/**
|
|
* Check whether a {@linkcode Pokemon} is currently fainted (as determined by {@linkcode Pokemon.isFainted}).
|
|
* @remarks
|
|
* When checking whether an enemy wild Pokemon is fainted, one must reference it in a variable _before_ the fainting effect occurs
|
|
* as otherwise the Pokemon will be GC'ed and rendered `undefined`.
|
|
*/
|
|
toHaveFainted(): void;
|
|
|
|
/**
|
|
* Check whether a {@linkcode Pokemon} has consumed the given amount of PP for one of its moves.
|
|
* @param expectedValue - The {@linkcode MoveId} of the {@linkcode PokemonMove} that should have consumed PP
|
|
* @param ppUsed - The numerical amount of PP that should have been consumed,
|
|
* or `all` to indicate the move should be _out_ of PP
|
|
* @remarks
|
|
* If the Pokemon's moveset has been set via {@linkcode Overrides.MOVESET_OVERRIDE}/{@linkcode Overrides.OPP_MOVESET_OVERRIDE},
|
|
* does not contain {@linkcode expectedMove}
|
|
* or contains the desired move more than once, this will fail the test.
|
|
*/
|
|
toHaveUsedPP(expectedMove: MoveId, ppUsed: number | "all"): void;
|
|
}
|
|
}
|