CI — Test & Build / 🧪 Run Tests & Generate Reports (push) Waiting to run
CI — Test & Build / 🏗️ Build Docker Image (push) Blocked by required conditions
CI — Test & Build / 🐳 Docker integration & API E2E (push) Blocked by required conditions
CI — Test & Build / 🌐 Staging Playwright smoke (push) Waiting to run
29 lines
1.1 KiB
JavaScript
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');
|
|
|
|
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');
|