// Point the DB at a closed port before the pool is built; the settings read is // monkeypatched in every test that reaches it, so no query runs. process.env.DB_HOST = '127.0.0.1' process.env.DB_PORT = '59999' // A brand URL, so the og:image absolutization of an uploaded path is exercised // rather than being dead code in the test environment. process.env.BRAND_URL = process.env.BRAND_URL || 'https://shard.example' // BRAND_LOGO defaults to empty (no logo image rendered), which would make the // "og:image still comes from env" assertions below pass vacuously. process.env.BRAND_LOGO = process.env.BRAND_LOGO || '/brand/logo.png' const { test, afterEach, after } = require('node:test') const assert = require('node:assert/strict') // The cached, settings-aware HTML shell (docs/website/THEMING_AND_NAV.md §4.3). // Three properties are load-bearing enough to lock here: that an untouched // instance gets byte-for-byte the shell it got before this feature existed, that // a DB fault still serves a page, and that the steady state is one cached string // rather than a settings read per page view. const htmlShell = require('../src/utils/htmlShell') const settings = require('../src/model/settings/settings.model') const brand = require('../src/config/brand') const db = require('../src/utils/db') after(() => db.close()) const originalGetShellBrand = settings.getShellBrand afterEach(() => { settings.getShellBrand = originalGetShellBrand }) // A stand-in for the built client/dist/index.html: the two tags the shell // rewrites plus the stylesheet link the theme block has to follow. const TEMPLATE = `