mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-05-07 00:44:04 +01:00
[Dev] Add imports, Handle kebab-case fileName argument in test boilerplate script (#4072)
* add imports, handle kebab-case fileName argument * fix spacing
This commit is contained in:
parent
8df7422e8f
commit
401568609b
@ -20,12 +20,15 @@ const type = args[0]; // "move" or "ability"
|
|||||||
let fileName = args[1]; // The file name
|
let fileName = args[1]; // The file name
|
||||||
|
|
||||||
if (!type || !fileName) {
|
if (!type || !fileName) {
|
||||||
console.error('Please provide both a type ("move", "ability", or "item") and a file name.');
|
console.error('Please provide a type ("move", "ability", or "item") and a file name.');
|
||||||
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
|
||||||
@ -64,10 +67,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;
|
||||||
@ -87,14 +92,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…
x
Reference in New Issue
Block a user