import assert from 'node:assert/strict'; import { describe, it } from 'node:test'; import { CONTENT_LANGUAGES } from './content-languages.ts'; import { CATEGORY_FORMULA_RULES, localizedCategoryPromptExample } from './categories/prompt-examples.ts'; const sections = ['title', 'description', 'meta'] as const; const expectedTagOrder = ['p', 'h2', 'p', 'h2', 'ul']; describe('localized category prompt SEO formulas', () => { it('covers every supported language with localized title, HTML description and SEO meta instructions', () => { assert.equal(Object.keys(CATEGORY_FORMULA_RULES).length, CONTENT_LANGUAGES.length); for (const { value: language } of CONTENT_LANGUAGES) { for (const section of sections) { const rule = localizedCategoryPromptExample(language, section); assert.equal(rule, CATEGORY_FORMULA_RULES[language][section]); assert.ok(rule.length > 90, `${language}/${section} incomplete`); assert.ok(rule.includes('{') && rule.includes('}'), `${language}/${section} missing instruction braces`); } const description = CATEGORY_FORMULA_RULES[language].description; assert.deepEqual([...description.matchAll(/<(p|h2|ul)(?=>)/g)].map((m) => m[1]), expectedTagOrder, `${language} wrong HTML order`); assert.equal((description.match(/