diff --git a/Documentation/FAC.md b/Documentation/FAC.md index 74d3530..ba56263 100644 --- a/Documentation/FAC.md +++ b/Documentation/FAC.md @@ -286,6 +286,28 @@ docker login gitea.mysuperlab.netcraze.pro --- +## Tests + +```powershell +npm test # whole suite +node --test server/__tests__/floor-brightness.test.js # one file +``` + +Runs `node --test server/__tests__/**/*.test.js` — **15 suites, 41 tests, ~1 s**. No test framework is installed: this is Node's built-in runner, and `node --test` expands the `**` pattern itself, so the command behaves the same from PowerShell, cmd and bash. + +The suite needs **no database and no running server** — the tests read the client's style and geometry modules from disk and call the server's validators directly. + +| Area | Test files | +|---|---| +| Hang geometry and clearance | `painting-column-clearance`, `doorway-clearance` | +| Period interiors | `abex-loft-interior`, `baroque-panels`, `dada-interior`, `high-renaissance-interior`, `mannerist-columns`, `neoclassical-interior`, `surrealist-interior` | +| Brightness and windows | `floor-brightness`, `no-factory-windows` | +| Movement links and lineage | `movement-lineage-service` | + +**Write the test before the code it covers** — see [Bible.md](Bible.md). The interior rules this suite enforces are described in [data-and-images.md](data-and-images.md). + +--- + ## Build frontend ```powershell diff --git a/Documentation/data-and-images.md b/Documentation/data-and-images.md index 040f2ec..1258ac4 100644 --- a/Documentation/data-and-images.md +++ b/Documentation/data-and-images.md @@ -326,6 +326,8 @@ Wing layout lives in `client/src/utils/movementHallLayout.ts` (up to 55 works pe **Paintings must not sit in front of mid-wall bay columns/pilasters.** Column Z centres use the same `bayPositions` formula as the period modules. Keep-out half-widths per `details` kind live in `client/src/utils/sideColumnKeepOuts.ts` (`SIDE_WALL_COLUMN_RHYTHMS`: gothic, roman, quattrocento, cinquecento, mannerist, neoclassical, gothic-revival, art-nouveau). Side-wall hang packs into the gaps between those keep-outs and **grows hall depth** when needed; columns are never moved. Windows also treat column keep-outs as occupied so they do not land on shafts. Regression: `server/__tests__/painting-column-clearance.test.js`. +Run `npm test` after touching any interior module, hall layout or tint: the rules above are covered by 15 suites under `server/__tests__/` that parse these source files directly — see [FAC.md](FAC.md) § Tests. + The same U-hang applies to artist halls and guided tours (artist halls have no period bay columns). Hall lighting is **shared** (no per-painting spotlights) so `MeshStandardMaterial` walls stay within WebGL light limits — see [basics.md](basics.md) § Shared 3D behaviour. To change a movement’s look, edit its entry in `movement-interior-styles.ts` and rebuild the client. ## Historical event markers (frontend timeline) diff --git a/Documentation/setup.md b/Documentation/setup.md index 1d2fa9b..2d5fe47 100644 --- a/Documentation/setup.md +++ b/Documentation/setup.md @@ -2,7 +2,7 @@ ## Prerequisites -- **Node.js** 20+ +- **Node.js** 20+ (verified on 24.19; `npm test` relies on `node --test` expanding `**` itself, which older majors may not do) - **PostgreSQL** reachable from the app host - Network access to Wikipedia / Wikimedia (for biographies, seeding, and on-demand image fetch) @@ -107,6 +107,7 @@ Image fetch can take hours if you run it for the entire catalog. The first line | Command | Purpose | |---------|---------| +| `npm test` | **Test suite** — 15 suites / 41 tests on Node’s built-in runner; no database or server needed | | `npm run dev:web` | **Public dev stack** — Vite `:5173`, API `:3451` (Keenetic → devgallery…) | | `npm run prod:docker:publish` | Build + push prod image to Gitea | | `npm run devtoprod:images` | Copy `data/images/` → TrueNAS via SMB `Gallery` share | diff --git a/README.md b/README.md index 05c8c8c..da1a4dc 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,14 @@ Operator guide: [Documentation/environments.md](Documentation/environments.md). npm run dev:web # Vite :5173, API :3451 ``` +**Tests** (Node’s built-in runner — no database or server needed): + +```bash +npm test # 15 suites, 41 tests +``` + +Per [Documentation/Bible.md](Documentation/Bible.md), write the test before the code it covers. + **Local HMR:** ```bash