Files
websitedev/proto/package.json
T
Do SikiandClaude Sonnet 5 e2b0c62628 test(cms): Payload config + Local API tests, fix stale Docker tests (MITHOME-96)
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>
2026-09-12 16:37:57 +02:00

71 lines
3.2 KiB
JSON
Executable File

{
"name": "proto",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev --turbopack",
"build": "next build --turbopack",
"start": "next start",
"lint": "eslint",
"test": "jest --config jest.config.unit.js",
"test:watch": "jest --config jest.config.unit.js --watch",
"test:coverage": "jest --config jest.config.unit.js --coverage",
"test:unit": "jest --config jest.config.unit.js",
"test:browser": "jest --config jest.config.js src/__tests__/browser-integration.test.ts",
"test:integration": "INTEGRATION_TESTS=1 jest --config jest.config.integration.js src/__tests__/integration.test.ts",
"test:e2e": "E2E_TESTS=1 jest --config jest.config.integration.js src/__tests__/e2e-docker.test.ts",
"test:smoke:staging": "playwright test --config=playwright.config.ts",
"test:docker": "npm run test:integration && npm run test:e2e",
"test:all": "npm run test:unit && npm run test:browser && npm run test:docker",
"test:report": "npm test -- --json --outputFile=test-results.json --silent && node ../scripts/sync-test-management.js",
"test:report:integration": "npm run test:integration -- --json --outputFile=integration-results.json --silent && node ../scripts/sync-test-management.js --results-path integration-results.json",
"test:sync": "node ../scripts/sync-test-management.js",
"test:gherkin": "npm run test:all -- --json --outputFile=test-results.json --silent && node ../scripts/generate-gherkin-reports.js test-results.json",
"test:update-tc": "node ../scripts/update-tc-issues.js",
"test:full-report": "npm run test:gherkin && npm run test:update-tc",
"docker:dev": "cd .. && docker-compose -f docker-compose.dev.yml up --build",
"docker:dev:down": "cd .. && docker-compose -f docker-compose.dev.yml down",
"docker:dev:logs": "cd .. && docker-compose -f docker-compose.dev.yml logs -f app",
"docker:build": "docker build -t mozdit-app .",
"docker:run": "docker run -p 3000:3000 --env-file .env.local mozdit-app",
"migrate:content": "node --env-file=.env.local --import tsx scripts/migrate-content-to-payload.ts",
"test:payload": "node --env-file=.env.local --import tsx scripts/test-payload-local-api.ts"
},
"dependencies": {
"@payloadcms/db-mongodb": "^3.88.0",
"@payloadcms/next": "^3.88.0",
"@payloadcms/richtext-lexical": "^3.88.0",
"graphql": "^16.14.2",
"mongodb": "^6.5",
"mongoose": "^8.2",
"next": "^16.3.4",
"payload": "^3.88.0",
"react": "19.1.0",
"react-dom": "19.1.0",
"sharp": "^0.35.4"
},
"devDependencies": {
"@eslint/eslintrc": "^3",
"@playwright/test": "^1.62.1",
"@tailwindcss/postcss": "^4",
"@testing-library/jest-dom": "^6.5",
"@testing-library/react": "^16.0",
"@testing-library/user-event": "^14.5",
"@types/jest": "^29.5",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"@types/winston": "^2.4",
"eslint": "^9",
"eslint-config-next": "^16.3.4",
"jest": "^29.7",
"jest-environment-jsdom": "^29.7",
"tailwindcss": "^4",
"tsx": "^4.23.13",
"typescript": "^5",
"undici": "^7.15.0",
"winston": "^3.11",
"winston-loki": "^6.0"
}
}