Added plan.md with complete architecture for format-agnostic content generation: - Support for Markdown, HTML, Plain Text, JSON formats - New FormatExporter module with neutral data structure - Integration strategy with existing ContentAssembly and ArticleStorage - Bonus features: SEO metadata generation, readability scoring, WordPress Gutenberg format - Implementation roadmap with 4 phases (6h total estimated) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
121 lines
4.3 KiB
JavaScript
121 lines
4.3 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert';
|
|
import { requireCommonJS } from './_helpers/commonjs-bridge.js';
|
|
|
|
// Tests basiques sans appels API ni WebSocket
|
|
|
|
test('Structure: Prompts nettoyés sans mentions polluantes', () => {
|
|
const { createBatchBasePrompt } = requireCommonJS('SelectiveEnhancement');
|
|
|
|
const mockElements = [{
|
|
tag: '|Titre_H1_1|',
|
|
element: { type: 'titre_h1', name: 'Titre_H1_1' }
|
|
}];
|
|
|
|
const mockCsvData = {
|
|
mc0: 'plaque personnalisée',
|
|
personality: {
|
|
nom: 'Marc',
|
|
style: 'technique',
|
|
description: 'Expert technique'
|
|
}
|
|
};
|
|
|
|
const prompt = createBatchBasePrompt(mockElements, 'titre', mockCsvData);
|
|
|
|
// Vérifier structure propre
|
|
assert.ok(prompt.includes('=== 1. CONTEXTE ==='), 'Structure CONTEXTE présente');
|
|
assert.ok(prompt.includes('=== 2. PERSONNALITÉ ==='), 'Structure PERSONNALITÉ présente');
|
|
assert.ok(prompt.includes('=== 3. RÈGLES GÉNÉRALES ==='), 'Structure RÈGLES présente');
|
|
assert.ok(prompt.includes('humainement'), 'Règle "humainement" présente');
|
|
|
|
// Vérifier absence mentions polluantes
|
|
assert.ok(!prompt.includes('CRÉER UN TITRE H1'), 'Pas de mention technique H1');
|
|
assert.ok(!prompt.includes('(8-12 mots)'), 'Pas de contrainte de mots');
|
|
assert.ok(!prompt.includes('NE PAS écrire'), 'Pas d\'instruction négative');
|
|
|
|
console.log('✅ Prompts structure rationnelle validée');
|
|
});
|
|
|
|
test('Structure: FAQ prompts nettoyés', () => {
|
|
const { createBatchFAQPairsPrompt } = requireCommonJS('SelectiveEnhancement');
|
|
|
|
const mockFaqPairs = [{
|
|
question: { tag: '|FAQ_Q1|' },
|
|
answer: { tag: '|FAQ_R1|' }
|
|
}];
|
|
|
|
const mockCsvData = {
|
|
mc0: 'plaque personnalisée',
|
|
personality: {
|
|
nom: 'Sophie',
|
|
style: 'commercial',
|
|
description: 'Experte vente'
|
|
}
|
|
};
|
|
|
|
const prompt = createBatchFAQPairsPrompt(mockFaqPairs, mockCsvData);
|
|
|
|
// Vérifier structure FAQ propre
|
|
assert.ok(prompt.includes('=== 1. CONTEXTE ==='), 'FAQ structure CONTEXTE');
|
|
assert.ok(prompt.includes('=== 4. PAIRES FAQ À GÉNÉRER ==='), 'FAQ section spécialisée');
|
|
assert.ok(prompt.includes('humainement'), 'FAQ règle humainement');
|
|
|
|
// Vérifier absence pollution FAQ
|
|
assert.ok(!prompt.includes('(8-15 mots)'), 'Pas de contrainte mots FAQ');
|
|
assert.ok(!prompt.includes('(50-80 mots)'), 'Pas de longueur réponse');
|
|
|
|
console.log('✅ FAQ prompts structure validée');
|
|
});
|
|
|
|
test('Structure: Fonctions principales existent', () => {
|
|
const modules = [
|
|
'MissingKeywords',
|
|
'SelectiveEnhancement',
|
|
'ContentGeneration',
|
|
'Main',
|
|
'BrainConfig'
|
|
];
|
|
|
|
modules.forEach(moduleName => {
|
|
try {
|
|
const module = requireCommonJS(moduleName);
|
|
assert.ok(typeof module === 'object', `${moduleName} est un objet`);
|
|
assert.ok(Object.keys(module).length > 0, `${moduleName} a des exports`);
|
|
} catch (error) {
|
|
assert.fail(`${moduleName} non chargeable: ${error.message}`);
|
|
}
|
|
});
|
|
|
|
console.log('✅ Tous les modules principaux chargent correctement');
|
|
});
|
|
|
|
test('Structure: Personnalités configuration existe', () => {
|
|
try {
|
|
const { selectMultiplePersonalitiesWithAI, getPersonalities } = requireCommonJS('BrainConfig');
|
|
|
|
assert.ok(typeof selectMultiplePersonalitiesWithAI === 'function', 'selectMultiplePersonalitiesWithAI existe');
|
|
assert.ok(typeof getPersonalities === 'function', 'getPersonalities existe');
|
|
|
|
console.log('✅ Système personnalités configuré');
|
|
|
|
} catch (error) {
|
|
assert.fail(`Système personnalités non disponible: ${error.message}`);
|
|
}
|
|
});
|
|
|
|
test('Structure: Pipeline 4 étapes fonctions existent', () => {
|
|
const {
|
|
generateAllContentBase,
|
|
enhanceAllTechnicalTerms,
|
|
enhanceAllTransitions,
|
|
enhanceAllPersonalityStyle
|
|
} = requireCommonJS('SelectiveEnhancement');
|
|
|
|
assert.ok(typeof generateAllContentBase === 'function', 'Étape 1 existe');
|
|
assert.ok(typeof enhanceAllTechnicalTerms === 'function', 'Étape 2 existe');
|
|
assert.ok(typeof enhanceAllTransitions === 'function', 'Étape 3 existe');
|
|
assert.ok(typeof enhanceAllPersonalityStyle === 'function', 'Étape 4 existe');
|
|
|
|
console.log('✅ Pipeline 4 étapes structure validée');
|
|
}); |