add copyright & disclaime and remove double content
All checks were successful
Deploy Sokko G / deploy (push) Successful in 6s
All checks were successful
Deploy Sokko G / deploy (push) Successful in 6s
This commit is contained in:
parent
15a904c008
commit
e65c74ea0a
5 changed files with 188 additions and 34 deletions
|
|
@ -2,6 +2,85 @@ import { readFile } from "node:fs/promises";
|
|||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
function valueAt(object, path) {
|
||||
return path.split(".").reduce((value, key) => value?.[key], object);
|
||||
}
|
||||
|
||||
function assertNonEmptyString(object, path) {
|
||||
const value = valueAt(object, path);
|
||||
assert.equal(typeof value, "string", `${path} must be a string`);
|
||||
assert.ok(value.trim(), `${path} must not be empty`);
|
||||
}
|
||||
|
||||
function assertStringArray(object, path, minLength = 1) {
|
||||
const value = valueAt(object, path);
|
||||
assert.ok(Array.isArray(value), `${path} must be an array`);
|
||||
assert.ok(value.length >= minLength, `${path} must contain at least ${minLength} item(s)`);
|
||||
value.forEach((item, index) => {
|
||||
assert.equal(typeof item, "string", `${path}[${index}] must be a string`);
|
||||
assert.ok(item.trim(), `${path}[${index}] must not be empty`);
|
||||
});
|
||||
}
|
||||
|
||||
function validateSiteContent(site) {
|
||||
[
|
||||
"brand.name",
|
||||
"brand.homeAriaLabel",
|
||||
"navigation.home",
|
||||
"navigation.toolboxes",
|
||||
"navigation.games",
|
||||
"navigation.mobileGames",
|
||||
"sidebar.badge",
|
||||
"sidebar.note",
|
||||
"topbar.dashboard",
|
||||
"topbar.toolbox",
|
||||
"topbar.games",
|
||||
"gamesPage.eyebrow",
|
||||
"gamesPage.title",
|
||||
"gamesPage.description",
|
||||
"gamesPage.emptyTitle",
|
||||
"gamesPage.emptyText",
|
||||
"home.hero.eyebrow",
|
||||
"home.hero.title",
|
||||
"home.hero.description",
|
||||
"home.hero.primaryAction",
|
||||
"home.hero.secondaryAction",
|
||||
"home.stats.toolboxSingular",
|
||||
"home.stats.toolboxPlural",
|
||||
"home.stats.toolSingular",
|
||||
"home.stats.toolPlural",
|
||||
"home.origin.eyebrow",
|
||||
"home.origin.title",
|
||||
"home.origin.visualAlt",
|
||||
"home.origin.dialogueAriaLabel",
|
||||
"home.origin.caption",
|
||||
"home.legal.copyright",
|
||||
"home.legal.disclaimer",
|
||||
"toolboxes.eyebrow",
|
||||
"toolboxes.title",
|
||||
"toolboxes.newButton",
|
||||
"toolboxes.importAll",
|
||||
"toolboxes.exportAll",
|
||||
"toolboxes.importOne",
|
||||
"toolboxes.summary",
|
||||
"toolboxes.storageHelp.title",
|
||||
"toolboxes.storageHelp.text",
|
||||
"toolboxes.emptyTitle",
|
||||
"toolboxes.emptyText"
|
||||
].forEach((path) => assertNonEmptyString(site, path));
|
||||
|
||||
assertStringArray(site, "toolboxes.storageHelp.items", 3);
|
||||
|
||||
const lines = valueAt(site, "home.origin.lines");
|
||||
assert.ok(Array.isArray(lines), "home.origin.lines must be an array");
|
||||
assert.ok(lines.length >= 2, "home.origin.lines must contain at least 2 items");
|
||||
lines.forEach((line, index) => {
|
||||
assert.ok(["user", "app"].includes(line?.speaker), `home.origin.lines[${index}].speaker must be "user" or "app"`);
|
||||
assert.equal(typeof line?.text, "string", `home.origin.lines[${index}].text must be a string`);
|
||||
assert.ok(line.text.trim(), `home.origin.lines[${index}].text must not be empty`);
|
||||
});
|
||||
}
|
||||
|
||||
test("vite entrypoint loads the react application", async () => {
|
||||
const html = await readFile("website/index.html", "utf8");
|
||||
|
||||
|
|
@ -150,6 +229,11 @@ test("react application defines the expected local toolbox primitives", async ()
|
|||
assert.match(screenshotsModule, /dataTransfer\.files/);
|
||||
});
|
||||
|
||||
test("site content json is complete", async () => {
|
||||
const site = JSON.parse(await readFile("website/public/data/site.json", "utf8"));
|
||||
validateSiteContent(site);
|
||||
});
|
||||
|
||||
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"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue