From 6c54695a7351fc9be92be870f6056cdf6386ac8e Mon Sep 17 00:00:00 2001 From: Bertie690 Date: Sun, 27 Jul 2025 20:01:37 -0400 Subject: [PATCH] ddd --- biome.jsonc | 3 +-- test/@types/vitest.d.ts | 14 +++++++------- .../test-utils/matchers/to-have-ability-applied.ts | 4 ++-- test/test-utils/matchers/to-have-effective-stat.ts | 1 + test/test-utils/matchers/to-have-fainted.ts | 4 ++-- .../matchers/to-have-stat-stage-matcher.ts | 2 +- .../matchers/to-have-taken-damage-matcher.ts | 9 +-------- 7 files changed, 15 insertions(+), 22 deletions(-) diff --git a/biome.jsonc b/biome.jsonc index d4cb67d33a6..311d0cfb063 100644 --- a/biome.jsonc +++ b/biome.jsonc @@ -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": { diff --git a/test/@types/vitest.d.ts b/test/@types/vitest.d.ts index 14a9f6d7533..d4aa5a447f4 100644 --- a/test/@types/vitest.d.ts +++ b/test/@types/vitest.d.ts @@ -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; } -} \ No newline at end of file +} diff --git a/test/test-utils/matchers/to-have-ability-applied.ts b/test/test-utils/matchers/to-have-ability-applied.ts index 234cb6831c3..6c78d23e2cb 100644 --- a/test/test-utils/matchers/to-have-ability-applied.ts +++ b/test/test-utils/matchers/to-have-ability-applied.ts @@ -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( diff --git a/test/test-utils/matchers/to-have-effective-stat.ts b/test/test-utils/matchers/to-have-effective-stat.ts index 1041682033d..c5d755bd096 100644 --- a/test/test-utils/matchers/to-have-effective-stat.ts +++ b/test/test-utils/matchers/to-have-effective-stat.ts @@ -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; diff --git a/test/test-utils/matchers/to-have-fainted.ts b/test/test-utils/matchers/to-have-fainted.ts index 1721379760d..33f8d439d19 100644 --- a/test/test-utils/matchers/to-have-fainted.ts +++ b/test/test-utils/matchers/to-have-fainted.ts @@ -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 { diff --git a/test/test-utils/matchers/to-have-stat-stage-matcher.ts b/test/test-utils/matchers/to-have-stat-stage-matcher.ts index 768a4e61421..466f933d246 100644 --- a/test/test-utils/matchers/to-have-stat-stage-matcher.ts +++ b/test/test-utils/matchers/to-have-stat-stage-matcher.ts @@ -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, }; diff --git a/test/test-utils/matchers/to-have-taken-damage-matcher.ts b/test/test-utils/matchers/to-have-taken-damage-matcher.ts index 12ee8e0722e..85d6b53985e 100644 --- a/test/test-utils/matchers/to-have-taken-damage-matcher.ts +++ b/test/test-utils/matchers/to-have-taken-damage-matcher.ts @@ -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, };