Files
websitedev/scripts/test-content-schema.js
T
Do SikiandClaude Opus 5.5 a3d6cbe404
CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Canceled after 0s
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Canceled after 0s
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Canceled after 0s
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Canceled after 0s
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Canceled after 0s
build(proto): mark the package as ESM so the Payload CLI loads the config (MITHOME-136)
The Payload CLI failed with ERR_REQUIRE_ASYNC_MODULE on Node 22 and 26 alike:
without "type": "module" it loaded payload.config.ts as CommonJS and could
not require the top-level-await ESM @payloadcms/richtext-lexical. Following
the official Payload template: "type": "module", CommonJS jest files and the
content schema renamed to .cjs, ESLint globs updated. Next's standalone
server.js is ESM and starts; 516 unit tests, tsc, lint and build are green.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 21:55:31 +02:00

29 lines
1.1 KiB
JavaScript

#!/usr/bin/env node
const assert = require('assert/strict');
const fs = require('fs');
const { validateContent } = require('../proto/src/content/schema.cjs');
const files = {
common: 'proto/src/content/common.json',
home: 'proto/src/content/pages/home.json',
about: 'proto/src/content/pages/about.json',
services: 'proto/src/content/pages/services.json',
contact: 'proto/src/content/pages/contact.json',
adatvedelem: 'proto/src/content/pages/adatvedelem.json',
hasznalatiFeltetelek: 'proto/src/content/pages/hasznalati-feltetelek.json',
};
for (const [key, file] of Object.entries(files)) {
const result = validateContent(key, JSON.parse(fs.readFileSync(file, 'utf8')));
assert.equal(result.ok, true, `${key}: ${result.errors.join('; ')}`);
}
const invalidHome = JSON.parse(fs.readFileSync(files.home, 'utf8'));
invalidHome.hero.trustBullets = [];
invalidHome.services['items[0]'] = invalidHome.services.items[0];
assert.deepEqual(validateContent('home', invalidHome).ok, false);
assert.match(validateContent('home', invalidHome).errors.join(' '), /nem engedélyezett mező/);
console.log('Content schema validation test: OK');