mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-15 12:52:20 +02:00
add imports, handle kebab-case fileName argument
This commit is contained in:
parent
e6a574c48f
commit
806d8ebe06
@ -23,8 +23,11 @@ if (!type || !fileName) {
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert fileName from to snake_case if camelCase is given
|
// Convert fileName from kebab-case or camelCase to snake_case
|
||||||
fileName = fileName.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase();
|
fileName = fileName
|
||||||
|
.replace(/-+/g, '_') // Convert kebab-case (dashes) to underscores
|
||||||
|
.replace(/([a-z])([A-Z])/g, '$1_$2') // Convert camelCase to snake_case
|
||||||
|
.toLowerCase(); // Ensure all lowercase
|
||||||
|
|
||||||
// Format the description for the test case
|
// Format the description for the test case
|
||||||
const formattedName = fileName
|
const formattedName = fileName
|
||||||
@ -60,10 +63,12 @@ if (fs.existsSync(filePath)) {
|
|||||||
|
|
||||||
// Define the content template
|
// Define the content template
|
||||||
const content = `import { Abilities } from "#enums/abilities";
|
const content = `import { Abilities } from "#enums/abilities";
|
||||||
|
import { Moves } from "#enums/moves";
|
||||||
|
import { Species } from "#enums/species";
|
||||||
import GameManager from "#test/utils/gameManager";
|
import GameManager from "#test/utils/gameManager";
|
||||||
import { SPLASH_ONLY } from "#test/utils/testUtils";
|
import { SPLASH_ONLY } from "#test/utils/testUtils";
|
||||||
import Phaser from "phaser";
|
import Phaser from "phaser";
|
||||||
import { afterEach, beforeAll, beforeEach, describe, it } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, it, expect } from "vitest";
|
||||||
|
|
||||||
describe("${description}", () => {
|
describe("${description}", () => {
|
||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
@ -83,14 +88,15 @@ describe("${description}", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
game = new GameManager(phaserGame);
|
game = new GameManager(phaserGame);
|
||||||
game.override
|
game.override
|
||||||
|
.moveset([Moves.SPLASH])
|
||||||
.battleType("single")
|
.battleType("single")
|
||||||
.enemyAbility(Abilities.BALL_FETCH)
|
.enemyAbility(Abilities.BALL_FETCH)
|
||||||
.enemyMoveset(SPLASH_ONLY);
|
.enemyMoveset(SPLASH_ONLY);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("test case", async () => {
|
it("test case", async () => {
|
||||||
// await game.classicMode.startBattle();
|
// await game.classicMode.startBattle([Species.MAGIKARP]);
|
||||||
// game.move.select();
|
// game.move.select(Moves.SPLASH);
|
||||||
}, TIMEOUT);
|
}, TIMEOUT);
|
||||||
});
|
});
|
||||||
`;
|
`;
|
||||||
|
Loading…
Reference in New Issue
Block a user