mirror of
https://github.com/Kornstalx/5etools-mirror-2.github.io.git
synced 2025-10-28 20:45:35 -05:00
v1.199.3
This commit is contained in:
35
test/test-adventure-book-credits.js
Normal file
35
test/test-adventure-book-credits.js
Normal file
@@ -0,0 +1,35 @@
|
||||
import "../js/parser.js";
|
||||
import "../js/utils.js";
|
||||
import * as ut from "../node/util.js";
|
||||
|
||||
const _BLOCKLIST_SOURCES = new Set([
|
||||
Parser.SRC_SCREEN,
|
||||
Parser.SRC_SCREEN_WILDERNESS_KIT,
|
||||
Parser.SRC_SCREEN_DUNGEON_KIT,
|
||||
Parser.SRC_SCREEN_SPELLJAMMER,
|
||||
]);
|
||||
|
||||
async function main () {
|
||||
console.log(`##### Validating adventure/book credits #####`);
|
||||
|
||||
[
|
||||
{filename: "adventures.json", prop: "adventure"},
|
||||
{filename: "books.json", prop: "book"},
|
||||
]
|
||||
.map(({filename, prop}) => {
|
||||
const json = ut.readJson(`./data/${filename}`);
|
||||
|
||||
const noCredits = json[prop]
|
||||
.filter(meta => {
|
||||
if (_BLOCKLIST_SOURCES.has(meta.source)) return false;
|
||||
return meta.contents && !meta.contents.some(it => it.name === "Credits");
|
||||
});
|
||||
if (!noCredits.length) return;
|
||||
|
||||
console.error(`\nMissing "Credits" chapters in "${filename}":\n${noCredits.map(meta => `\t${meta.source}`).join("\n")}`);
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
export default main();
|
||||
Reference in New Issue
Block a user