[Refactor] Cleanup test boilerplate script (#4547)

This commit is contained in:
Adrian T. 2024-10-03 01:08:30 +08:00 committed by GitHub
parent 8a2900ad29
commit ea261a039d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 7 deletions

View File

@ -1,9 +1,7 @@
/** /**
* This script creates a test boilerplate file for a move or ability. * This script creates a test boilerplate file in the appropriate
* @param {string} type - The type of test to create. Either "move", "ability", * directory based on the type selected.
* or "item". * @example npm run create-test
* @param {string} fileName - The name of the file to create.
* @example npm run create-test move tackle
*/ */
import fs from "fs"; import fs from "fs";
@ -34,7 +32,7 @@ async function promptTestType() {
console.log("Exiting..."); console.log("Exiting...");
return process.exit(); return process.exit();
} else if (!typeChoices.includes(typeAnswer.selectedOption)) { } else if (!typeChoices.includes(typeAnswer.selectedOption)) {
console.error('Please provide a valid type ("move", "ability", or "item")!'); console.error(`Please provide a valid type (${typeChoices.join(", ")})!`);
return await promptTestType(); return await promptTestType();
} }
@ -102,7 +100,7 @@ async function runInteractive() {
description = `Mystery Encounter - ${formattedName}`; description = `Mystery Encounter - ${formattedName}`;
break; break;
default: default:
console.error('Invalid type. Please use "move", "ability", or "item".'); console.error(`Invalid type. Please use one of the following: ${typeChoices.join(", ")}.`);
process.exit(1); process.exit(1);
} }