Adds the two test categories the ticket asked for, replacing the old
content-JSON-schema-only testing story now that Payload is the real
source of truth:
1. src/payload-config.test.ts — fast, DB-free unit tests over the
Collection/Global config objects themselves. WHY not importing
payload.config.ts directly: it pulls in the real `payload` and
`@payloadcms/db-mongodb` packages as values (not just types), which
are ESM-only and Jest's default transformIgnorePatterns skips
node_modules entirely — confirmed by trying it
(`SyntaxError: Cannot use import statement outside a module` from
payload's own dist). Individual collection/global files only ever
`import type` from 'payload' (erased at compile time), so they're
safely importable in isolation. Two of the assertions are
deliberate regression guards for real bugs found earlier this
session (MITHOME-121): Media.access.read must stay public, and
Partners.logo must stay optional.
2. scripts/test-payload-local-api.ts (npm run test:payload) — exercises
every src/lib/payload-content.ts getter plus a full
create/findByID/delete cycle against a real, already-migrated
MongoDB. WHY a plain node script instead of a Jest integration
config: same ESM problem as above, and Payload's dependency graph
is too broad to safely add to transformIgnorePatterns — this
follows the same working `node --import tsx` pattern already used
by migrate-content-to-payload.ts. Not wired into
pre-deploy-tests.sh (needs a live, pre-migrated MongoDB, same
reasoning as the removed CMS integration tests); run manually or
before a release.
3. Fixed the pre-existing (Docker-stack-gated, so silently never
caught) staleness in integration.test.ts and e2e-docker.test.ts:
unprefixed routes (/rolunk) → locale-prefixed (/hu/rolunk), and
Mongo assertions against the old site_config/contact_submissions
collections → the real globals/legal-pages/partners/
contact-submissions collections Payload actually uses. Also fixed
an unrelated stale error-message assertion for spam detection that
never matched the route's real string.
Verified: full gate green (tsc, lint, 63 unit tests — 13 new — build),
and separately ran test:payload live against the dev MongoDB (8/8
passed, including the write/read/delete cycle actually hitting Mongo).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>