From 69f3533c4176d3d92e0e10c8ca1c296317e3ffe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D1=82=D0=BE=D0=BD=20=D0=A2=D1=80=D0=BE=D1=88?= =?UTF-8?q?=D0=B8=D0=BD?= Date: Sun, 4 Oct 2026 17:36:31 +0300 Subject: [PATCH] test(validate): cover cu prayers, shared marker-type constant - validate-data now scans cu/services/prayers (349 files; 331 -> 680 total). - marker types (TROPARION/KONTAKION/THEOTOKION/LITANY/COMMUNION) factored into PRAYER_NODE_TYPES with a keep-in-sync comment. - COMMUNION marker (cu COMMUNION/SUN.json) added per the same convention. --- scripts/validate-data.ts | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/scripts/validate-data.ts b/scripts/validate-data.ts index d0ec7c7..872197b 100644 --- a/scripts/validate-data.ts +++ b/scripts/validate-data.ts @@ -11,6 +11,16 @@ import { fileURLToPath } from 'url'; const __dirname = new URL('.', import.meta.url).pathname; const DATA_DIR = join(__dirname, '..', 'static', 'data'); +/** + * Node types allowed in prayer files. Besides TEXT/HEADER content nodes, + * imported prayers carry bare classification markers (no payload) that the + * assembler intentionally ignores — keep this list in sync with the data. + */ +const PRAYER_NODE_TYPES = [ + 'TEXT', 'HEADER', + 'TROPARION', 'KONTAKION', 'THEOTOKION', 'LITANY', 'COMMUNION', +]; + interface ValidationError { file: string; path: string; @@ -152,10 +162,8 @@ class Validator { continue; } const obj = node as Record; - // LITANY/THEOTOKION are bare classification markers (no payload): - // TROPARION/KONTAKION have the same convention, content is TEXT/HEADER. - if (!obj.type || !['TEXT', 'HEADER', 'TROPARION', 'KONTAKION', 'LITANY', 'THEOTOKION'].includes(obj.type as string)) { - this.addError(path, `[${i}].type`, 'Type must be TEXT, HEADER, TROPARION, KONTAKION, LITANY or THEOTOKION'); + if (!obj.type || !PRAYER_NODE_TYPES.includes(obj.type as string)) { + this.addError(path, `[${i}].type`, `Type must be one of: ${PRAYER_NODE_TYPES.join(', ')}`); } } } @@ -265,6 +273,13 @@ function main() { validator.validateDir(join(enDir, 'services', 'commands'), 'command'); } + // Church Slavonic prayers share the same import format and marker types + const cuDir = join(DATA_DIR, 'cu'); + if (existsSync(cuDir)) { + console.log('Validating Church Slavonic data...'); + validator.validateDir(join(cuDir, 'services', 'prayers'), 'prayer'); + } + validator.printReport(); }