diff --git a/src/data/moves/pokemon-move.ts b/src/data/moves/pokemon-move.ts index d3f68fe9db4..c0f3bf3e753 100644 --- a/src/data/moves/pokemon-move.ts +++ b/src/data/moves/pokemon-move.ts @@ -9,7 +9,7 @@ import { toDmgValue } from "#utils/common"; * These are the moves assigned to a {@linkcode Pokemon} object. * It links to {@linkcode Move} class via the move ID. * Compared to {@linkcode Move}, this class also tracks things like - * PP Ups recieved, PP used, etc. + * PP Ups received, PP used, etc. * @see {@linkcode isUsable} - checks if move is restricted, out of PP, or not implemented. * @see {@linkcode getMove} - returns {@linkcode Move} object by looking it up via ID. * @see {@linkcode usePp} - removes a point of PP from the move. diff --git a/test/test-utils/matchers/to-have-ability-applied.ts b/test/test-utils/matchers/to-have-ability-applied.ts index 8ef343c6d74..1ed74410de0 100644 --- a/test/test-utils/matchers/to-have-ability-applied.ts +++ b/test/test-utils/matchers/to-have-ability-applied.ts @@ -22,7 +22,7 @@ export function toHaveAbilityApplied( if (!isPokemonInstance(received)) { return { pass: this.isNot, - message: () => `Expected to recieve a Pokemon, but got ${receivedStr(received)}!`, + message: () => `Expected to receive a Pokemon, but got ${receivedStr(received)}!`, }; } diff --git a/test/test-utils/matchers/to-have-arena-tag.ts b/test/test-utils/matchers/to-have-arena-tag.ts index fe9e2a05605..dee7c133f25 100644 --- a/test/test-utils/matchers/to-have-arena-tag.ts +++ b/test/test-utils/matchers/to-have-arena-tag.ts @@ -6,7 +6,6 @@ import type { OneOther } from "#test/@types/test-helpers"; import type { GameManager } from "#test/test-utils/game-manager"; import { getOnelineDiffStr } from "#test/test-utils/string-utils"; import { isGameManagerInstance, receivedStr } from "#test/test-utils/test-utils"; -import type { NonFunctionPropertiesRecursive } from "#types/type-helpers"; import type { MatcherState, SyncExpectationResult } from "@vitest/expect"; // intersection required to preserve T for inferences @@ -26,14 +25,13 @@ export type toHaveArenaTagOptions = OneOther( this: MatcherState, received: unknown, - // simplified types used for brevity; full overloads are in `vitest.d.ts` - expectedTag: T | (Partial> & { tagType: T; side: ArenaTagSide }), + expectedTag: T | toHaveArenaTagOptions, side?: ArenaTagSide, ): SyncExpectationResult { if (!isGameManagerInstance(received)) { return { pass: this.isNot, - message: () => `Expected to recieve a GameManager, but got ${receivedStr(received)}!`, + message: () => `Expected to receive a GameManager, but got ${receivedStr(received)}!`, }; } @@ -44,19 +42,19 @@ export function toHaveArenaTag( }; } - if (typeof expectedTag === "string") { - // Coerce lone `tagType`s into objects - // Bangs are ok as we enforce safety via overloads - expectedTag = { tagType: expectedTag, side: side! }; - } + // Coerce lone `tagType`s into objects + // Bangs are ok as we enforce safety via overloads + // @ts-expect-error - Typescript is being stupid as tag type and side will always exist + const etag: Partial & { tagType: T; side: ArenaTagSide } = + typeof expectedTag === "object" ? expectedTag : { tagType: expectedTag, side: side! }; // We need to get all tags for the case of checking properties of a tag present on both sides of the arena - const tags = received.scene.arena.findTagsOnSide(t => t.tagType === expectedTag.tagType, expectedTag.side); + const tags = received.scene.arena.findTagsOnSide(t => t.tagType === etag.tagType, etag.side); if (tags.length === 0) { return { pass: false, - message: () => `Expected the Arena to have a tag of type ${expectedTag.tagType}, but it didn't!`, - expected: expectedTag.tagType, + message: () => `Expected the Arena to have a tag of type ${etag.tagType}, but it didn't!`, + expected: etag.tagType, actual: received.scene.arena.tags.map(t => t.tagType), }; } diff --git a/test/test-utils/matchers/to-have-positional-tag.ts b/test/test-utils/matchers/to-have-positional-tag.ts index 8449313d661..448339d6a8d 100644 --- a/test/test-utils/matchers/to-have-positional-tag.ts +++ b/test/test-utils/matchers/to-have-positional-tag.ts @@ -2,7 +2,7 @@ import type { GameManager } from "#test/test-utils/game-manager"; // biome-ignore-end lint/correctness/noUnusedImports: TSDoc -import type { SerializedPositionalTag, serializedPosTagMap } from "#data/positional-tags/load-positional-tag"; +import type { serializedPosTagMap } from "#data/positional-tags/load-positional-tag"; import type { PositionalTagType } from "#enums/positional-tag-type"; import type { OneOther } from "#test/@types/test-helpers"; import { getOnelineDiffStr } from "#test/test-utils/string-utils"; @@ -25,14 +25,13 @@ export type toHavePositionalTagOptions

= OneOther( this: MatcherState, received: unknown, - // simplified types used for brevity; full overloads are in `vitest.d.ts` - expectedTag: P | (Partial & { tagType: P }), + expectedTag: P | toHavePositionalTagOptions

, count = 1, ): SyncExpectationResult { if (!isGameManagerInstance(received)) { return { pass: this.isNot, - message: () => `Expected to recieve a GameManager, but got ${receivedStr(received)}!`, + message: () => `Expected to receive a GameManager, but got ${receivedStr(received)}!`, }; } diff --git a/test/test-utils/matchers/to-have-types.ts b/test/test-utils/matchers/to-have-types.ts index 14a1e33ef4a..1c13fc083ae 100644 --- a/test/test-utils/matchers/to-have-types.ts +++ b/test/test-utils/matchers/to-have-types.ts @@ -27,7 +27,15 @@ export interface toHaveTypesOptions { * Matcher that checks if a Pokemon's typing is as expected. * @param received - The object to check. Should be a {@linkcode Pokemon} * @param expectedTypes - An array of one or more {@linkcode PokemonType}s to compare against. - * @param mode - The mode to perform the matching; + * @param mode - The mode to perform the matching in. + * Possible values (in ascending order of strength) are: + * - `"ordered"`: Enforce that the {@linkcode Pokemon}'s types are identical **and in the same order** + * - `"unordered"`: Enforce that the {@linkcode Pokemon}'s types are identical **without checking order** + * - `"superset"`: Enforce that the {@linkcode Pokemon}'s types are **a superset of** the expected types + * (all must be present, but extras can be there) + * + * Default `unordered` + * @param args - Extra arguments passed to {@linkcode Pokemon.getTypes} * @returns The result of the matching */ export function toHaveTypes( @@ -39,7 +47,7 @@ export function toHaveTypes( if (!isPokemonInstance(received)) { return { pass: this.isNot, - message: () => `Expected to recieve a Pokémon, but got ${receivedStr(received)}!`, + message: () => `Expected to receive a Pokémon, but got ${receivedStr(received)}!`, }; }