mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-26 17:29:30 +02:00
Merge pull request #15 from PokeRogue-Projects/beta
Update Beta into Main
This commit is contained in:
commit
eef70a0b7a
101
create-test-boilerplate.js
Normal file
101
create-test-boilerplate.js
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
import fs from 'fs';
|
||||||
|
import path from 'path';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This script creates a test boilerplate file for a move or ability.
|
||||||
|
* @param {string} type - The type of test to create. Either "move" or "ability".
|
||||||
|
* @param {string} fileName - The name of the file to create.
|
||||||
|
* @example npm run create-test move tackle
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Get the directory name of the current module file
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
|
// Get the arguments from the command line
|
||||||
|
const args = process.argv.slice(2);
|
||||||
|
const type = args[0]; // "move" or "ability"
|
||||||
|
let fileName = args[1]; // The file name
|
||||||
|
|
||||||
|
if (!type || !fileName) {
|
||||||
|
console.error('Please provide both a type ("move" or "ability") and a file name.');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert fileName from to snake_case if camelCase is given
|
||||||
|
fileName = fileName.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase();
|
||||||
|
|
||||||
|
// Format the description for the test case
|
||||||
|
const formattedName = fileName
|
||||||
|
.replace(/_/g, ' ')
|
||||||
|
.replace(/\b\w/g, char => char.toUpperCase());
|
||||||
|
|
||||||
|
// Determine the directory based on the type
|
||||||
|
let dir;
|
||||||
|
let description;
|
||||||
|
if (type === 'move') {
|
||||||
|
dir = path.join(__dirname, 'src', 'test', 'moves');
|
||||||
|
description = `Moves - ${formattedName}`;
|
||||||
|
} else if (type === 'ability') {
|
||||||
|
dir = path.join(__dirname, 'src', 'test', 'abilities');
|
||||||
|
description = `Abilities - ${formattedName}`;
|
||||||
|
} else {
|
||||||
|
console.error('Invalid type. Please use "move" or "ability".');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure the directory exists
|
||||||
|
if (!fs.existsSync(dir)) {
|
||||||
|
fs.mkdirSync(dir, { recursive: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the file with the given name
|
||||||
|
const filePath = path.join(dir, `${fileName}.test.ts`);
|
||||||
|
|
||||||
|
if (fs.existsSync(filePath)) {
|
||||||
|
console.error(`File "${fileName}.test.ts" already exists.`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define the content template
|
||||||
|
const content = `import { Abilities } from "#enums/abilities";
|
||||||
|
import GameManager from "#test/utils/gameManager";
|
||||||
|
import { SPLASH_ONLY } from "#test/utils/testUtils";
|
||||||
|
import Phaser from "phaser";
|
||||||
|
import { afterEach, beforeAll, beforeEach, describe, it } from "vitest";
|
||||||
|
|
||||||
|
describe("${description}", () => {
|
||||||
|
let phaserGame: Phaser.Game;
|
||||||
|
let game: GameManager;
|
||||||
|
const TIMEOUT = 20 * 1000;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
phaserGame = new Phaser.Game({
|
||||||
|
type: Phaser.HEADLESS,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
game.phaseInterceptor.restoreOg();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
game = new GameManager(phaserGame);
|
||||||
|
game.override
|
||||||
|
.battleType("single")
|
||||||
|
.enemyAbility(Abilities.BALL_FETCH)
|
||||||
|
.enemyMoveset(SPLASH_ONLY);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("test case", async () => {
|
||||||
|
// await game.classicMode.startBattle();
|
||||||
|
// game.move.select();
|
||||||
|
}, TIMEOUT);
|
||||||
|
});
|
||||||
|
`;
|
||||||
|
|
||||||
|
// Write the template content to the file
|
||||||
|
fs.writeFileSync(filePath, content, 'utf8');
|
||||||
|
|
||||||
|
console.log(`File created at: ${filePath}`);
|
@ -38,7 +38,8 @@ export default [
|
|||||||
"ignoreComments": false // Enforces the rule on lines containing comments
|
"ignoreComments": false // Enforces the rule on lines containing comments
|
||||||
}],
|
}],
|
||||||
"space-before-blocks": ["error", "always"], // Enforces a space before blocks
|
"space-before-blocks": ["error", "always"], // Enforces a space before blocks
|
||||||
"keyword-spacing": ["error", { "before": true, "after": true }] // Enforces spacing before and after keywords
|
"keyword-spacing": ["error", { "before": true, "after": true }], // Enforces spacing before and after keywords
|
||||||
|
"comma-spacing": ["error", { "before": false, "after": true }] // Enforces spacing after comma
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
12
index.css
12
index.css
@ -17,6 +17,12 @@ body {
|
|||||||
background: #484050;
|
background: #484050;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (display-mode: fullscreen) {
|
||||||
|
body {
|
||||||
|
background: #000000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#links {
|
#links {
|
||||||
width: 90%;
|
width: 90%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -142,10 +148,10 @@ input:-internal-autofill-selected {
|
|||||||
|
|
||||||
/* Show cycle buttons only on STARTER_SELECT and on touch configuration panel */
|
/* Show cycle buttons only on STARTER_SELECT and on touch configuration panel */
|
||||||
#touchControls:not(.config-mode):not([data-ui-mode='STARTER_SELECT']) #apadOpenFilters,
|
#touchControls:not(.config-mode):not([data-ui-mode='STARTER_SELECT']) #apadOpenFilters,
|
||||||
#touchControls:not(.config-mode):not([data-ui-mode='STARTER_SELECT']) #apadCycleForm,
|
#touchControls:not(.config-mode):not([data-ui-mode='STARTER_SELECT'], [data-ui-mode='RUN_INFO']) #apadCycleForm,
|
||||||
#touchControls:not(.config-mode):not([data-ui-mode='STARTER_SELECT']) #apadCycleShiny,
|
#touchControls:not(.config-mode):not([data-ui-mode='STARTER_SELECT'], [data-ui-mode='RUN_INFO']) #apadCycleShiny,
|
||||||
#touchControls:not(.config-mode):not([data-ui-mode='STARTER_SELECT']) #apadCycleNature,
|
#touchControls:not(.config-mode):not([data-ui-mode='STARTER_SELECT']) #apadCycleNature,
|
||||||
#touchControls:not(.config-mode):not([data-ui-mode='STARTER_SELECT']) #apadCycleAbility,
|
#touchControls:not(.config-mode):not([data-ui-mode='STARTER_SELECT'], [data-ui-mode='RUN_INFO']) #apadCycleAbility,
|
||||||
#touchControls:not(.config-mode):not([data-ui-mode='STARTER_SELECT']) #apadCycleGender,
|
#touchControls:not(.config-mode):not([data-ui-mode='STARTER_SELECT']) #apadCycleGender,
|
||||||
#touchControls:not(.config-mode):not([data-ui-mode='STARTER_SELECT']) #apadCycleVariant {
|
#touchControls:not(.config-mode):not([data-ui-mode='STARTER_SELECT']) #apadCycleVariant {
|
||||||
display: none;
|
display: none;
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
"eslint-ci": "eslint .",
|
"eslint-ci": "eslint .",
|
||||||
"docs": "typedoc",
|
"docs": "typedoc",
|
||||||
"depcruise": "depcruise src",
|
"depcruise": "depcruise src",
|
||||||
"depcruise:graph": "depcruise src --output-type dot | node dependency-graph.js > dependency-graph.svg"
|
"depcruise:graph": "depcruise src --output-type dot | node dependency-graph.js > dependency-graph.svg",
|
||||||
|
"create-test": "node ./create-test-boilerplate.js"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^9.3.0",
|
"@eslint/js": "^9.3.0",
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user