pokerogue/src/test/imports.test.ts
NightKev 828897316e
[Test] Replace doAttack() with move.select() in tests (#3567)
* Consolidate `doSelectTarget()` into `doAttack()`

* Fix ternary

* Add error message to aid in debugging tests

* Update docs

* [Test] Change `doAttack()` to `selectMove()`

* Add `select()` to `src/test/utils/helpers/moveHelper.ts`

* Replace instances of `game.selectMove()` with `game.move.select()`

* Fix imports

* Replace `selectMove()` with `move.select()` helper

Fix broken tests for Pastel Veil and Sweet Veil

* Update tsdocs
2024-08-22 06:49:33 -07:00

36 lines
954 B
TypeScript

import { initStatsKeys } from "#app/ui/game-stats-ui-handler";
import { describe, expect, it } from "vitest";
async function importModule() {
try {
initStatsKeys();
const { PokemonMove } = await import("#app/field/pokemon");
const { Species } = await import("#enums/species");
return {
PokemonMove,
Species,
};
// Dynamically import the module
} catch (error) {
// Log the error stack trace
console.error("Error during import:", error.stack);
// Rethrow the error to ensure the test fails
throw error;
}
}
describe("tests to debug the import, with trace", () => {
it("import PokemonMove module", async () => {
const module = await importModule();
// Example assertion
expect(module.PokemonMove).toBeDefined();
});
it("import Species module", async () => {
const module = await importModule();
// Example assertion
expect(module.Species).toBeDefined();
});
});