This commit is contained in:
Bertie690 2025-07-27 20:01:37 -04:00
parent 3a6026d637
commit 6c54695a73
7 changed files with 15 additions and 22 deletions

View File

@ -19,7 +19,6 @@
// and having to verify whether each individual file is ignored
"includes": [
"**",
"!**/*.d.ts",
"!**/dist/**/*",
"!**/build/**/*",
"!**/coverage/**/*",
@ -179,7 +178,7 @@
// Overrides to prevent unused import removal inside `overrides.ts` and enums files (for TSDoc linkcodes)
{
"includes": ["**/src/overrides.ts", "**/src/enums/**/*"],
"includes": ["**/src/overrides.ts", "**/src/enums/**/*", "**/*.d.ts"],
"linter": {
"rules": {
"correctness": {

View File

@ -1,17 +1,17 @@
import type { Pokemon } from "#field/pokemon";
import type { PokemonType } from "#enums/pokemon-type";
import type { expect } from "vitest";
import type { toHaveTypesOptions } from "#test/test-utils/matchers/to-have-types";
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 { TerrainType } from "#app/data/terrain";
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 { TurnMove } from "#types/turn-move";
import { expectedStatusType } from "#test/test-utils/matchers/to-have-status-effect-matcher";
import type { toHaveTypesOptions } from "#test/test-utils/matchers/to-have-types";
import { TurnMove } from "#types/turn-move";
import type { expect } from "vitest";
declare module "vitest" {
interface Assertion {
@ -117,4 +117,4 @@ declare module "vitest" {
*/
toHaveFainted(): void;
}
}
}

View File

@ -9,8 +9,8 @@ import type { MatcherState, SyncExpectationResult } from "@vitest/expect";
/**
* Matcher to check if a {@linkcode Pokemon} had a specific {@linkcode AbilityId} applied.
* @param received - The object to check. Should be a {@linkcode Pokemon}.
* @param expectedAbility - The {@linkcode AbilityId} to check for.
* @param received - The object to check. Should be a {@linkcode Pokemon}
* @param expectedAbility - The {@linkcode AbilityId} to check for
* @returns Whether the matcher passed
*/
export function toHaveAbilityAppliedMatcher(

View File

@ -47,6 +47,7 @@ export function toHaveEffectiveStatMatcher(
};
}
// TODO: Change once getEffectiveStat is refactored to take an object literal
const actualValue = received.getEffectiveStat(stat, enemy, move, undefined, undefined, undefined, isCritical);
const pass = actualValue === expectedValue;

View File

@ -3,8 +3,8 @@ import { isPokemonInstance, receivedStr } from "#test/test-utils/test-utils";
import type { MatcherState, SyncExpectationResult } from "@vitest/expect";
/**
* Matcher to check if a Pokemon has fainted
* @param received - The object to check. Should be a {@linkcode Pokemon}.
* Matcher to check if a Pokemon has fainted.
* @param received - The object to check. Should be a {@linkcode Pokemon}
* @returns Whether the matcher passed
*/
export function toHaveFaintedMatcher(this: MatcherState, received: unknown): SyncExpectationResult {

View File

@ -41,7 +41,7 @@ export function toHaveStatStageMatcher(
message: () =>
pass
? `Expected ${pkmName}'s ${statName} stat stage to NOT be ${expectedStage}, but it was!`
: `Expected ${pkmName}'s ${statName} stage to be ${expectedStage}, but got ${actualStage}!`,
: `Expected ${pkmName}'s ${statName} stat stage to be ${expectedStage}, but got ${actualStage} instead!`,
actual: actualStage,
expected: expectedStage,
};

View File

@ -3,13 +3,6 @@ import { isPokemonInstance, receivedStr } from "#test/test-utils/test-utils";
import { toDmgValue } from "#utils/common";
import type { MatcherState, SyncExpectationResult } from "@vitest/expect";
//#region Types
export interface ToHaveTakenDamageMatcherOptions {
/** Whether to skip the internal {@linkcode toDmgValue} call. @defaultValue false */
skipToDmgValue?: boolean;
} //#endregion
/**
* Matcher to check if a Pokemon has taken a specific amount of damage.
* Unless specified, will run the expected damage value through {@linkcode toDmgValue}
@ -42,7 +35,7 @@ export function toHaveTakenDamageMatcher(
message: () =>
pass
? `Expected ${pkmName} to NOT have taken ${expectedDmgValue} damage, but it did!`
: `Expected ${pkmName} to have taken ${expectedDmgValue} damage, but got ${actualDmgValue}!`,
: `Expected ${pkmName} to have taken ${expectedDmgValue} damage, but got ${actualDmgValue} instead!`,
expected: expectedDmgValue,
actual: actualDmgValue,
};