Strengthen shell behavior tests and profile toolbox loading
All checks were successful
Deploy Sokko G / deploy (push) Successful in 18s
All checks were successful
Deploy Sokko G / deploy (push) Successful in 18s
This commit is contained in:
parent
a9b68a5712
commit
b53c7c17c8
8 changed files with 323 additions and 61 deletions
|
|
@ -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 () => {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ test("toolbox storage, cards and pages are wired", async () => {
|
|||
const guidedTooltipTour = await readFile("website/src/components/GuidedTooltipTour.jsx", "utf8");
|
||||
const reorderHook = await readFile("website/src/hooks/usePointerReorder.js", "utf8");
|
||||
const groupedReorderHook = await readFile("website/src/hooks/useGroupedReorder.js", "utf8");
|
||||
const inlineEditHook = await readFile("website/src/hooks/useInlineEdit.js", "utf8");
|
||||
const draftFormHook = await readFile("website/src/hooks/useDraftForm.js", "utf8");
|
||||
|
||||
assert.match(`${indexedToolboxesHook}\n${toolboxPages}`, /indexedDbStorage\.js/);
|
||||
|
|
@ -124,15 +123,9 @@ test("toolbox storage, cards and pages are wired", async () => {
|
|||
assert.match(toolboxPages, /setDrawerGameId\(""\)/);
|
||||
assert.match(toolboxPages, /moduleColumns/);
|
||||
assert.match(toolboxPages, /normalizeCombosData/);
|
||||
assert.match(toolboxPages, /function ToolboxView/);
|
||||
assert.match(toolboxPages, /GuidedTooltipTour/);
|
||||
assert.match(toolboxPages, /data-toolbox-tutorial-target/);
|
||||
assert.match(guidedTooltipTour, /document\.querySelector/);
|
||||
assert.match(guidedTooltipTour, /--tutorial-arrow-left/);
|
||||
assert.match(guidedTooltipTour, /--tutorial-arrow-top/);
|
||||
assert.match(guidedTooltipTour, /data-placement/);
|
||||
assert.match(toolboxPages, /toolbox\.tutorial === true/);
|
||||
assert.match(toolboxPages, /tutorial: false/);
|
||||
assert.doesNotMatch(toolboxPages, /usePointerReorder/);
|
||||
assert.match(storageQuota, /export function StorageQuota/);
|
||||
assert.match(storageQuota, /role="progressbar"/);
|
||||
|
|
@ -148,20 +141,13 @@ test("toolbox storage, cards and pages are wired", async () => {
|
|||
assert.match(groupedReorderHook, /export function applyGroupedReorderOperation/);
|
||||
assert.match(groupedReorderHook, /data-reorder-orientation/);
|
||||
assert.match(groupedReorderHook, /operation\.sourceParentId === operation\.targetParentId/);
|
||||
assert.match(inlineEditHook, /export function useInlineEdit/);
|
||||
assert.match(inlineEditHook, /skipCommitRef/);
|
||||
assert.match(inlineEditHook, /blurOnEscape/);
|
||||
assert.match(inlineEditHook, /commitOnEnter/);
|
||||
assert.match(inlineEditHook, /getContentEditableProps/);
|
||||
assert.match(draftFormHook, /export function useDraftForm/);
|
||||
assert.match(draftFormHook, /getFieldProps/);
|
||||
assert.match(draftFormHook, /handleSubmit/);
|
||||
assert.match(draftFormHook, /preventDefault/);
|
||||
assert.match(toolboxCoverEditor, /createImageBitmap/);
|
||||
assert.match(toolboxCoverEditor, /image\/webp/);
|
||||
assert.match(toolboxCoverEditor, /OUTPUT_WIDTH = 620/);
|
||||
assert.match(toolboxCoverEditor, /OUTPUT_HEIGHT = 248/);
|
||||
assert.match(toolboxCoverEditor, /getCoverCropSourceRect/);
|
||||
assert.doesNotMatch(toolboxCoverEditor, /react-easy-crop|react-image-crop/);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue