124 lines
7.1 KiB
JavaScript
124 lines
7.1 KiB
JavaScript
// Rôle : conserve les conventions éditoriales et les assets du shell non couverts par les parcours navigateur.
|
|
import { readFile } from "node:fs/promises";
|
|
import { test } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
test("vite entrypoint and app shell are wired", async () => {
|
|
const html = await readFile("website/index.html", "utf8");
|
|
const source = await readFile("website/src/main.jsx", "utf8");
|
|
const gameFiltersHook = await readFile("website/src/hooks/useGameFilters.js", "utf8");
|
|
const shell = await readFile("website/src/components/Shell.jsx", "utf8");
|
|
const toolboxPages = await readFile("website/src/features/toolboxes/ToolboxPages.jsx", "utf8");
|
|
const importButton = await readFile("website/src/components/ImportButton.jsx", "utf8");
|
|
const overlays = await readFile("website/src/components/AppOverlays.jsx", "utf8");
|
|
const imageViewer = await readFile("website/src/components/ImageViewer.jsx", "utf8");
|
|
const homePage = await readFile("website/src/pages/HomePage.jsx", "utf8");
|
|
const aboutPage = await readFile("website/src/pages/AboutPage.jsx", "utf8");
|
|
const routeContent = await readFile("website/src/router/RouteContent.jsx", "utf8");
|
|
|
|
assert.match(html, /<div id="app"><\/div>/);
|
|
assert.match(html, /\/favicon\.ico/);
|
|
assert.match(html, /\/src\/main\.jsx/);
|
|
assert.match(source, /styles\/main\.scss/);
|
|
assert.match(source, /hooks\/useGameFilters\.js/);
|
|
assert.doesNotMatch(source, /DEFAULT_SITE_CONTENT/);
|
|
assert.match(gameFiltersHook, /export function useGameFilters/);
|
|
assert.match(routeContent, /features\/games\/GameRoute\.jsx/);
|
|
assert.doesNotMatch(shell, /content\.navigation\.library/);
|
|
assert.match(shell, /sidebar-about-link/);
|
|
assert.match(shell, /dragon-sidebar\.png/);
|
|
assert.match(shell, /ImportButton/);
|
|
assert.match(shell, /compactSidebar/);
|
|
assert.match(shell, /compactSidebar = Boolean\(drawerGameId\)/);
|
|
assert.doesNotMatch(shell, /import\.meta\.env\.DEV \|\| Boolean\(drawerGameId\)/);
|
|
assert.match(shell, /data-variant=\{compactSidebar \? "compact"/);
|
|
assert.match(shell, /toolbox-drawer-open/);
|
|
assert.match(shell, /position="right"/);
|
|
assert.match(importButton, /tooltipPosition/);
|
|
assert.match(toolboxPages, /DRAWER_INITIAL_WIDTH = 700/);
|
|
assert.doesNotMatch(toolboxPages, /drawerWidth|dbGetSetting|dbSetSetting/);
|
|
assert.match(overlays, /\.\/ImageViewer\.jsx/);
|
|
assert.match(overlays, /uid\("marker"\)/);
|
|
assert.match(imageViewer, /export function ImageViewer/);
|
|
assert.match(imageViewer, /function openImageInNewTab/);
|
|
assert.match(homePage, /dragon-home\.png/);
|
|
assert.match(aboutPage, /module-icon-\$\{group\.icon \|\| "notepad"\}/);
|
|
});
|
|
|
|
test("project documentation tracks storage and feature updates", async () => {
|
|
const storageSchema = await readFile("docs/STORAGE_SCHEMA.md", "utf8");
|
|
const featureChecklist = await readFile("docs/FEATURE_CHECKLIST.md", "utf8");
|
|
|
|
assert.match(storageSchema, /IndexedDB/);
|
|
assert.match(storageSchema, /Outil Checklist/);
|
|
assert.match(storageSchema, /Outil Images/);
|
|
assert.match(storageSchema, /Outil Annotation d'images/);
|
|
assert.match(storageSchema, /Outil Calculateur/);
|
|
assert.match(storageSchema, /Outil Randomizer/);
|
|
assert.match(featureChecklist, /Mettre à jour `docs\/STORAGE_SCHEMA\.md`/);
|
|
assert.match(featureChecklist, /npm run check/);
|
|
});
|
|
|
|
test("server and vite support local env configuration", async () => {
|
|
const server = await readFile("server.mjs", "utf8");
|
|
const viteConfig = await readFile("vite.config.js", "utf8");
|
|
const envExample = await readFile(".env.example", "utf8");
|
|
|
|
assert.match(server, /load-project-env\.mjs/);
|
|
assert.match(server, /process\.env\.PORT/);
|
|
assert.match(viteConfig, /load-project-env\.mjs/);
|
|
assert.match(viteConfig, /process\.env\.PORT/);
|
|
assert.match(envExample, /PORT=5173/);
|
|
});
|
|
|
|
test("legacy icons and primary images are available", async () => {
|
|
const manifest = JSON.parse(await readFile("website/public/data/toolbox-icons.json", "utf8"));
|
|
|
|
assert.ok(manifest.icons.length >= 4);
|
|
await readFile("website/public/static/icons/home.svg", "utf8");
|
|
await readFile("website/public/static/icons/add.svg", "utf8");
|
|
await readFile("website/public/static/icons/checklist.svg", "utf8");
|
|
await readFile("website/public/static/icons/close.svg", "utf8");
|
|
await readFile("website/public/static/icons/columns.svg", "utf8");
|
|
await readFile("website/public/static/icons/copy.svg", "utf8");
|
|
await readFile("website/public/static/icons/abacus.svg", "utf8");
|
|
await readFile("website/public/static/icons/calculator.svg", "utf8");
|
|
await readFile("website/public/static/icons/diagram.svg", "utf8");
|
|
await readFile("website/public/static/icons/map.svg", "utf8");
|
|
await readFile("website/public/static/icons/enter.svg", "utf8");
|
|
await readFile("website/public/static/icons/export.svg", "utf8");
|
|
await readFile("website/public/static/icons/hide.svg", "utf8");
|
|
await readFile("website/public/static/icons/chevron-down.svg", "utf8");
|
|
await readFile("website/public/static/icons/chevron-up.svg", "utf8");
|
|
await readFile("website/public/static/icons/scrollable.svg", "utf8");
|
|
await readFile("website/public/static/icons/notepad.svg", "utf8");
|
|
await readFile("website/public/static/icons/picture.svg", "utf8");
|
|
await readFile("website/public/static/icons/rows.svg", "utf8");
|
|
await readFile("website/public/static/icons/rubber.svg", "utf8");
|
|
await readFile("website/public/static/icons/trashcan.svg", "utf8");
|
|
await readFile("website/public/static/icons/zoom.svg", "utf8");
|
|
await readFile("website/public/static/icons/warning.svg", "utf8");
|
|
await readFile("website/public/static/icons/axe.svg", "utf8");
|
|
await readFile("website/public/static/icons/cube.svg", "utf8");
|
|
await readFile("website/public/static/icons/dice.svg", "utf8");
|
|
await readFile("website/public/static/icons/fire.svg", "utf8");
|
|
await readFile("website/public/static/icons/shield.svg", "utf8");
|
|
await readFile("website/public/static/icons/wing.svg", "utf8");
|
|
await readFile("website/public/favicon.ico");
|
|
await readFile("website/public/static/img/dragon-home.png");
|
|
await readFile("website/public/static/img/dragon-sidebar.png");
|
|
await readFile("website/public/static/img/dragon-dual-monitor.png");
|
|
await readFile("website/public/static/img/dragon-session-tools.png");
|
|
await readFile("website/public/static/img/dragon-game-guides.png");
|
|
await readFile("website/public/static/img/dragon-local-data.png");
|
|
await readFile("website/public/static/img/dragon-contribution-data.png");
|
|
await readFile("website/public/static/img/dragon-gameguide.png");
|
|
await readFile("website/public/static/img/dragon-toolbox.png");
|
|
await readFile("website/public/static/img/onboarding/toolbox-overview.png");
|
|
await readFile("website/public/static/img/onboarding/toolbox-tools.png");
|
|
await readFile("website/public/static/img/onboarding/toolbox-save.png");
|
|
await readFile("website/public/static/img/onboarding/toolbox-game-link.png");
|
|
await readFile("website/public/static/img/toolbox-icons/toolbox.png");
|
|
await readFile("website/public/static/img/toolbox-icons/sword.png");
|
|
await readFile("website/public/static/img/toolbox-icons/puzzle.png");
|
|
});
|