mirror of
https://github.com/Kornstalx/5etools-mirror-2.github.io.git
synced 2025-10-28 20:45:35 -05:00
v1.198.1
This commit is contained in:
27
test/test-misc.js
Normal file
27
test/test-misc.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import "../js/parser.js";
|
||||
import "../js/utils.js";
|
||||
|
||||
function testCatIds () {
|
||||
const errors = [];
|
||||
Object.keys(Parser.CAT_ID_TO_FULL).forEach(catId => {
|
||||
if (Parser.CAT_ID_TO_PROP[catId] === undefined) errors.push(`Missing property for ID: ${catId} (${Parser.CAT_ID_TO_FULL[catId]})`);
|
||||
if (UrlUtil.CAT_TO_PAGE[catId] === undefined) errors.push(`Missing page for ID: ${catId} (${Parser.CAT_ID_TO_FULL[catId]})`);
|
||||
});
|
||||
return errors;
|
||||
}
|
||||
|
||||
async function main () {
|
||||
let anyErrors = false;
|
||||
|
||||
const errorsCatIds = testCatIds();
|
||||
if (errorsCatIds.length) {
|
||||
anyErrors = true;
|
||||
console.error(`Category ID errors:`);
|
||||
errorsCatIds.forEach(it => console.error(`\t${it}`));
|
||||
}
|
||||
|
||||
if (!anyErrors) console.log("##### Misc Tests Passed #####");
|
||||
return !anyErrors; // invert the result as this is what the test runner expects
|
||||
}
|
||||
|
||||
export default main();
|
||||
Reference in New Issue
Block a user