mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-09-23 15:03:24 +02:00
Replace toContains with has.tobe
This commit is contained in:
parent
e801afa8e9
commit
890a8767a9
@ -12,7 +12,7 @@ import { EnemyPokemon } from "#field/pokemon";
|
|||||||
import { GameManager } from "#test/test-utils/game-manager";
|
import { GameManager } from "#test/test-utils/game-manager";
|
||||||
import { NumberHolder } from "#utils/common";
|
import { NumberHolder } from "#utils/common";
|
||||||
import { afterEach } from "node:test";
|
import { afterEach } from "node:test";
|
||||||
import { beforeAll, describe, expect, it, vi } from "vitest";
|
import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
|
||||||
|
|
||||||
// Need a function for creating a mock pokemon
|
// Need a function for creating a mock pokemon
|
||||||
|
|
||||||
@ -157,7 +157,6 @@ describe("Unit Tests - ai-moveset-gen.ts", () => {
|
|||||||
describe("", () => {
|
describe("", () => {
|
||||||
//#region boilerplate
|
//#region boilerplate
|
||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
// biome-ignore lint/correctness/noUnusedVariables: May be used by tests later
|
|
||||||
let game: GameManager;
|
let game: GameManager;
|
||||||
/**A pokemon object that will be cleaned up after every test */
|
/**A pokemon object that will be cleaned up after every test */
|
||||||
let pokemon: EnemyPokemon | null = null;
|
let pokemon: EnemyPokemon | null = null;
|
||||||
@ -174,6 +173,10 @@ describe("Unit Tests - ai-moveset-gen.ts", () => {
|
|||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
pokemon?.destroy();
|
pokemon?.destroy();
|
||||||
});
|
});
|
||||||
|
// Sanitize the interceptor after running the suite to ensure other tests are not affected
|
||||||
|
afterAll(() => {
|
||||||
|
game.phaseInterceptor.restoreOg();
|
||||||
|
});
|
||||||
//#endregion boilerplate
|
//#endregion boilerplate
|
||||||
|
|
||||||
function createCharmander(_ = pokemon): asserts _ is EnemyPokemon {
|
function createCharmander(_ = pokemon): asserts _ is EnemyPokemon {
|
||||||
@ -205,7 +208,8 @@ describe("Unit Tests - ai-moveset-gen.ts", () => {
|
|||||||
]);
|
]);
|
||||||
vi.spyOn(allMoves[MoveId.TACKLE], "name", "get").mockReturnValue("Tackle (N)");
|
vi.spyOn(allMoves[MoveId.TACKLE], "name", "get").mockReturnValue("Tackle (N)");
|
||||||
const result = getAndWeightLevelMoves(pokemon);
|
const result = getAndWeightLevelMoves(pokemon);
|
||||||
expect(result).toContain(MoveId.GROWL);
|
expect(result.has(MoveId.TACKLE)).toBe(false);
|
||||||
|
expect(result.has(MoveId.GROWL)).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("skips moves already in the pool", () => {
|
it("skips moves already in the pool", () => {
|
||||||
@ -239,7 +243,6 @@ describe("Unit Tests - ai-moveset-gen.ts", () => {
|
|||||||
describe("Regression Tests - ai-moveset-gen.ts", () => {
|
describe("Regression Tests - ai-moveset-gen.ts", () => {
|
||||||
//#region boilerplate
|
//#region boilerplate
|
||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
// biome-ignore lint/correctness/noUnusedVariables: May be used by tests later
|
|
||||||
let game: GameManager;
|
let game: GameManager;
|
||||||
/**A pokemon object that will be cleaned up after every test */
|
/**A pokemon object that will be cleaned up after every test */
|
||||||
let pokemon: EnemyPokemon | null = null;
|
let pokemon: EnemyPokemon | null = null;
|
||||||
@ -256,6 +259,10 @@ describe("Regression Tests - ai-moveset-gen.ts", () => {
|
|||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
pokemon?.destroy();
|
pokemon?.destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
afterAll(() => {
|
||||||
|
game.phaseInterceptor.restoreOg();
|
||||||
|
});
|
||||||
//#endregion boilerplate
|
//#endregion boilerplate
|
||||||
|
|
||||||
describe("getTmPoolForSpecies", () => {
|
describe("getTmPoolForSpecies", () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user