add list page and multiples optis
All checks were successful
Deploy Sokko G / deploy (push) Successful in 7s
All checks were successful
Deploy Sokko G / deploy (push) Successful in 7s
This commit is contained in:
parent
d9d22683dc
commit
959fa42454
30 changed files with 1015 additions and 45 deletions
|
|
@ -19,6 +19,7 @@ test("mhwilds data and assets are available", async () => {
|
|||
const games = JSON.parse(await readFile("website/public/data/games.json", "utf8"));
|
||||
const monsters = JSON.parse(await readFile("website/public/data/mhwilds/monsters.json", "utf8"));
|
||||
const endemicLife = JSON.parse(await readFile("website/public/data/mhwilds/endemic_life.json", "utf8"));
|
||||
const listIndex = JSON.parse(await readFile("website/public/data/mhwilds/lists/index.json", "utf8"));
|
||||
const translations = JSON.parse(await readFile("website/public/data/mhwilds/i18n/fr.json", "utf8"));
|
||||
const enTranslations = JSON.parse(await readFile("website/public/data/mhwilds/i18n/en.json", "utf8"));
|
||||
const listingSource = await readFile("website/src/features/games/mhwilds/MhwildsListing.jsx", "utf8");
|
||||
|
|
@ -39,6 +40,27 @@ test("mhwilds data and assets are available", async () => {
|
|||
assert.ok(endemicLife.locations.length > 0, "endemicLife.locations must not be empty");
|
||||
assert.ok(endemicLife.endemicLife.length > 0);
|
||||
validateEndemicData(endemicLife);
|
||||
assert.ok(Array.isArray(listIndex.lists), "mhwilds list index must expose lists");
|
||||
assert.ok(listIndex.lists.length >= 1, "mhwilds list index must contain at least one list");
|
||||
for (const list of listIndex.lists) {
|
||||
assert.equal(typeof list.id, "string", "mhwilds list id must be a string");
|
||||
assert.equal(typeof list.title, "string", "mhwilds list title must be a string");
|
||||
assert.match(list.file, /\.json$/, "mhwilds list file must target a json file");
|
||||
const listData = JSON.parse(await readFile(`website/public/data/mhwilds/lists/${list.file}`, "utf8"));
|
||||
assert.equal(typeof listData.titre, "string", `${list.file}.titre must be a string`);
|
||||
assert.ok(listData.titre.trim(), `${list.file}.titre must not be empty`);
|
||||
for (const [category, items] of Object.entries(listData).filter(([key]) => key !== "titre")) {
|
||||
assert.ok(Array.isArray(items), `mhwilds list category ${category} must be an array`);
|
||||
items.forEach((item, index) => {
|
||||
assert.equal(typeof item.nom, "string", `${list.file}.${category}[${index}].nom must be a string`);
|
||||
assert.ok(item.nom.trim(), `${list.file}.${category}[${index}].nom must not be empty`);
|
||||
assert.equal(typeof item.description, "string", `${list.file}.${category}[${index}].description must be a string`);
|
||||
if (item.quantite !== undefined) {
|
||||
assert.ok(Number.isFinite(Number(item.quantite)), `${list.file}.${category}[${index}].quantite must be numeric`);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
validateTranslationKeys(translations, "fr");
|
||||
validateTranslationKeys(enTranslations, "en");
|
||||
assert.equal(translations.monsters, "monstres");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue