Strengthen shell behavior tests and profile toolbox loading
All checks were successful
Deploy Sokko G / deploy (push) Successful in 18s

This commit is contained in:
Shinuwa 2026-09-12 13:15:42 +02:00
parent a9b68a5712
commit b53c7c17c8
8 changed files with 323 additions and 61 deletions

View file

@ -1,4 +1,4 @@
// Rôle : vérifie les invariants statiques du shell, du routing et des overlays.
// 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";
@ -6,67 +6,32 @@ 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 appDataHook = await readFile("website/src/hooks/useAppData.js", "utf8");
const gameFiltersHook = await readFile("website/src/hooks/useGameFilters.js", "utf8");
const shell = await readFile("website/src/components/Shell.jsx", "utf8");
const overlays = await readFile("website/src/components/AppOverlays.jsx", "utf8");
const modals = await readFile("website/src/components/ToolboxModals.jsx", "utf8");
const imageViewer = await readFile("website/src/components/ImageViewer.jsx", "utf8");
const richText = await readFile("website/src/components/RichText.jsx", "utf8");
const homePage = await readFile("website/src/pages/HomePage.jsx", "utf8");
const homeOnboarding = await readFile("website/src/pages/HomeOnboardingSection.jsx", "utf8");
const aboutPage = await readFile("website/src/pages/AboutPage.jsx", "utf8");
const libraryPage = await readFile("website/src/pages/LibraryPage.jsx", "utf8");
const moduleRegistry = await readFile("website/src/features/toolboxes/toolboxModuleRegistry.js", "utf8");
const hashRouter = await readFile("website/src/router/hashRouter.js", "utf8");
const routeContent = await readFile("website/src/router/RouteContent.jsx", "utf8");
const bodyScrollLock = await readFile("website/src/utils/bodyScrollLock.js", "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, /components\/Shell\.jsx/);
assert.match(source, /components\/AppOverlays\.jsx/);
assert.match(source, /router\/RouteContent\.jsx/);
assert.match(source, /hooks\/useAppData\.js/);
assert.match(source, /hooks\/useGameFilters\.js/);
assert.doesNotMatch(source, /DEFAULT_SITE_CONTENT/);
assert.match(appDataHook, /export function useAppData/);
assert.match(appDataHook, /\/data\/site\.json/);
assert.match(appDataHook, /setSiteContentError/);
assert.match(gameFiltersHook, /export function useGameFilters/);
assert.match(hashRouter, /export function useHashRoute/);
assert.match(hashRouter, /export function navigate/);
assert.match(routeContent, /export function RouteContent/);
assert.match(routeContent, /pages\/HomePage\.jsx/);
assert.match(routeContent, /pages\/AboutPage\.jsx/);
assert.match(routeContent, /pages\/LibraryPage\.jsx/);
assert.match(routeContent, /route === "\/library"/);
assert.match(routeContent, /features\/games\/GameRoute\.jsx/);
assert.match(shell, /export function Shell/);
assert.doesNotMatch(shell, /content\.navigation\.library/);
assert.match(shell, /sidebar-about-link/);
assert.match(shell, /dragon-sidebar\.png/);
assert.match(shell, /ImportButton/);
assert.match(overlays, /export function AppOverlays/);
assert.match(overlays, /\.\/ToolboxModals\.jsx/);
assert.match(overlays, /\.\/ImageViewer\.jsx/);
assert.match(overlays, /uid\("marker"\)/);
assert.match(modals, /export function ConfirmModal/);
assert.match(modals, /export function CreateToolboxModal/);
assert.match(modals, /export function LinkToolboxModal/);
assert.match(modals, /export function NotificationToast/);
assert.match(modals, /durationMs = 120000/);
assert.match(modals, /setTimeout\(\(\) => onClose\(id\), durationMs\)/);
assert.match(source, /SHORT_NOTIFICATION_DURATION_MS = 5000/);
assert.match(source, /getNotificationDuration/);
assert.match(modals, /useModalScrollLock/);
assert.match(imageViewer, /export function ImageViewer/);
assert.match(imageViewer, /function openImageInNewTab/);
assert.match(richText, /value\.split\("\\n"\)/);
assert.match(richText, /<br key=/);
assert.match(homePage, /export function HomePage/);
assert.match(homePage, /HomeOnboardingSection/);
assert.match(homePage, /import\.meta\.env\.DEV \|\| toolboxes\.length === 0/);
assert.match(homePage, /setCreateModal\(\{ tutorial: true \}\)/);
@ -82,16 +47,6 @@ test("vite entrypoint and app shell are wired", async () => {
assert.match(aboutPage, /siteContent\.home\.onboarding/);
assert.match(aboutPage, /module-icon-\$\{group\.icon \|\| "notepad"\}/);
assert.match(aboutPage, /about-tool-examples/);
assert.match(libraryPage, /export function LibraryPage/);
assert.match(libraryPage, /LIBRARY_TOOLBOX_ID/);
assert.match(libraryPage, /toolboxModuleComponents\.jsx/);
assert.match(moduleRegistry, /export const TOOLBOX_MODULE_LOADERS/);
assert.match(moduleRegistry, /taskPlanner: \(\) => import\("\.\/modules\/TaskPlannerModule\.jsx"\)/);
assert.match(moduleRegistry, /equipmentPlanner: \(\) => import\("\.\/modules\/EquipmentPlannerModule\.jsx"\)/);
assert.match(libraryPage, /normalizeEquipmentPlannerData/);
assert.match(libraryPage, /summarizeEquipmentPlannerData/);
assert.match(bodyScrollLock, /modalLocks/);
assert.match(bodyScrollLock, /is-modal-open/);
});
test("project documentation tracks storage and feature updates", async () => {