Add custom toolbox card covers
All checks were successful
Deploy Sokko G / deploy (push) Successful in 18s

This commit is contained in:
Shinuwa 2026-09-05 15:41:56 +02:00
parent 25889a23ba
commit 06de3a3a6e
13 changed files with 7480 additions and 38 deletions

View file

@ -10,6 +10,7 @@ import {
validateSiteContent,
validateTranslationKeys
} from "./helpers/data-validation.mjs";
import { compactModuleDataForStorage, normalizeToolbox } from "../website/src/features/toolboxes/storage/toolboxStorage.js";
test("site content json is complete", async () => {
const site = JSON.parse(await readFile("website/public/data/site.json", "utf8"));
@ -25,6 +26,27 @@ test("library examples are available", async () => {
assert.equal(notepadModule?.title, "Bloc Note");
});
test("library toolbox export is import-compatible", async () => {
const library = JSON.parse(await readFile("website/public/data/library.json", "utf8"));
const payload = JSON.parse(await readFile("website/public/data/library-toolbox-export.json", "utf8"));
const toolbox = normalizeToolbox(payload.toolbox);
const moduleIds = new Set(toolbox.modules.map((module) => module.id));
assert.equal(toolbox.name, "Librairie");
assert.equal(toolbox.modules.length, library.toolbox.modules.length);
assert.deepEqual(toolbox.modules.map((module) => module.type), library.toolbox.modules.map((module) => module.type));
assert.deepEqual(new Set(Object.keys(payload.modules)), moduleIds);
toolbox.modules.forEach((module) => {
const exportedModule = payload.toolbox.modules.find((item) => item.id === module.id);
assert.ok(exportedModule, `module ${module.id} must be declared`);
assert.equal(exportedModule.controls, undefined, `${module.id} must not include library docs controls`);
assert.equal(exportedModule.features, undefined, `${module.id} must not include library docs features`);
assert.equal(exportedModule.importFormat, undefined, `${module.id} must not include library docs import format`);
assert.ok(compactModuleDataForStorage(module.type, payload.modules[module.id]), `${module.id} data must be compactable`);
});
});
test("mhwilds data and assets are available", async () => {
const site = JSON.parse(await readFile("website/public/data/site.json", "utf8"));
const games = JSON.parse(await readFile("website/public/data/games.json", "utf8"));