- Fix BatchProcessor constructor to avoid server blocking during startup - Add comprehensive integration tests for all modular combinations - Enhance CLAUDE.md documentation with new test commands - Update SelectiveLayers configuration for better LLM allocation - Add AutoReporter system for test automation - Include production workflow validation tests 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
161 lines
6.2 KiB
JavaScript
161 lines
6.2 KiB
JavaScript
#!/usr/bin/env node
|
||
|
||
import test from 'node:test';
|
||
import assert from 'node:assert';
|
||
import { requireCommonJS } from './_helpers/commonjs-bridge.js';
|
||
import { AutoReporter } from './reporters/AutoReporter.js';
|
||
|
||
/**
|
||
* TEST PIPELINE RAPIDE 4 PHASES - VERSION ALLÉGÉE POUR RAPPORT
|
||
*
|
||
* WORKFLOW RAPIDE:
|
||
* 1. Génération Initiale (contenu de base)
|
||
* 2. Adversarial Light (anti-détection légère)
|
||
* 3. Light Enhancement (amélioration technique)
|
||
* 4. Light Simulation (humanisation)
|
||
*/
|
||
|
||
// Auto-Reporter Configuration
|
||
const autoReporter = new AutoReporter();
|
||
|
||
// Configuration pipeline rapide
|
||
const mockCsvData = {
|
||
mc0: 'solution digital enterprise',
|
||
t0: 'Pipeline rapide génération content avec enhancement modulaire',
|
||
personality: {
|
||
nom: 'Alex',
|
||
style: 'efficace-technique',
|
||
description: 'Expert en solutions rapides et efficaces'
|
||
}
|
||
};
|
||
|
||
console.log('🚀 TEST PIPELINE RAPIDE 4 PHASES');
|
||
console.log('⚡ Version optimisée pour génération rapport AutoReporter');
|
||
|
||
test('Pipeline Rapide TI: 4 Phases Express', { timeout: 180000 }, async () => {
|
||
console.log('\n🔄 === DÉMARRAGE PIPELINE 4 PHASES EXPRESS ===');
|
||
|
||
// =========================================
|
||
// PHASE 1: GÉNÉRATION INITIALE
|
||
// =========================================
|
||
console.log('\n📝 PHASE 1/4: Génération Initiale (Content de base)');
|
||
|
||
// Content de base simplifié
|
||
let result = {
|
||
content: {
|
||
'Titre_H1': 'Solutions digitales enterprise pour transformation métier avec architecture évolutive',
|
||
'Introduction': 'Les solutions digitales enterprise facilitent la transformation des processus métier grâce à leur architecture modulaire et leurs outils analytics avancés.',
|
||
'Avantages_Techniques': 'Architecture cloud avec APIs sécurisées, scalabilité automatique, monitoring temps réel et intelligence artificielle intégrée.',
|
||
'Conclusion': 'Investissement stratégique permettant digitalisation complète et amélioration productive durable.'
|
||
}
|
||
};
|
||
|
||
assert.ok(result.content, 'Content initial préparé');
|
||
console.log('✅ Phase 1: Content initial préparé');
|
||
console.log(`📊 Content initial: ${Object.keys(result.content).length} éléments`);
|
||
|
||
// =========================================
|
||
// PHASE 2: ADVERSARIAL LIGHT (rapide)
|
||
// =========================================
|
||
console.log('\n🛡️ PHASE 2/4: Adversarial Light (Anti-détection rapide)');
|
||
|
||
const AdversarialLayers = requireCommonJS('adversarial-generation/AdversarialLayers');
|
||
|
||
result = await AdversarialLayers.applyPredefinedStack(
|
||
result.content,
|
||
'lightDefense', // Stack léger et rapide
|
||
{
|
||
...mockCsvData,
|
||
preferredProvider: 'claude',
|
||
intensity: 0.8 // Intensité modérée
|
||
},
|
||
{ source: 'pipeline_rapide_ti_phase2' }
|
||
);
|
||
|
||
assert.ok(result.content, 'Adversarial light appliqué');
|
||
console.log('✅ Phase 2: Adversarial light terminé');
|
||
console.log(`📊 Anti-détection: ${result.stats?.layersApplied || 'light'} couches appliquées`);
|
||
|
||
// =========================================
|
||
// PHASE 3: LIGHT ENHANCEMENT (rapide)
|
||
// =========================================
|
||
console.log('\n⚡ PHASE 3/4: Light Enhancement (Technique)');
|
||
|
||
const { applyPredefinedStack } = requireCommonJS('selective-enhancement/SelectiveLayers');
|
||
|
||
result = await applyPredefinedStack(
|
||
result.content,
|
||
'lightEnhancement', // Stack le plus rapide
|
||
{
|
||
...mockCsvData,
|
||
preferredProvider: 'openai', // OpenAI rapide et fiable
|
||
intensity: 1.0
|
||
},
|
||
{ source: 'pipeline_rapide_ti_phase3' }
|
||
);
|
||
|
||
assert.ok(result.content, 'Light enhancement appliqué');
|
||
console.log('✅ Phase 3: Light enhancement terminé');
|
||
console.log(`📊 Enhancement: ${result.stats?.layersApplied || 'technique'} couches appliquées`);
|
||
|
||
// =========================================
|
||
// PHASE 4: LIGHT SIMULATION (rapide)
|
||
// =========================================
|
||
console.log('\n👤 PHASE 4/4: Light Simulation (Humanisation)');
|
||
|
||
const { applyPredefinedSimulation } = requireCommonJS('human-simulation/HumanSimulationLayers');
|
||
|
||
result = await applyPredefinedSimulation(
|
||
result.content,
|
||
'lightSimulation', // Simulation légère
|
||
{
|
||
...mockCsvData,
|
||
humanization: 0.6, // Niveau modéré
|
||
fatigueLevel: 0.2, // Fatigue légère
|
||
preferredProvider: 'claude'
|
||
}
|
||
);
|
||
|
||
assert.ok(result.content, 'Light simulation appliquée');
|
||
console.log('✅ Phase 4: Light simulation terminée');
|
||
console.log(`📊 Humanisation: simulation légère avec personnalité ${mockCsvData.personality.nom}`);
|
||
|
||
// =========================================
|
||
// VALIDATION FINALE
|
||
// =========================================
|
||
console.log('\n🎯 === VALIDATION PIPELINE RAPIDE ===');
|
||
|
||
const finalContent = result.content;
|
||
const contentKeys = Object.keys(finalContent);
|
||
|
||
// Vérifications qualité finale
|
||
assert.ok(contentKeys.length >= 4, `Au moins 4 éléments (trouvé: ${contentKeys.length})`);
|
||
|
||
// Vérification contenu non vide
|
||
contentKeys.forEach(key => {
|
||
assert.ok(finalContent[key] && finalContent[key].length > 30,
|
||
`Element ${key} doit contenir du contenu`);
|
||
});
|
||
|
||
console.log('\n📈 === RÉSULTATS PIPELINE RAPIDE ===');
|
||
console.log(`✅ 4 phases exécutées avec succès`);
|
||
console.log(`📝 Content final: ${contentKeys.length} éléments`);
|
||
console.log(`📊 Longueur totale: ${Object.values(finalContent).join(' ').length} caractères`);
|
||
console.log(`🎭 Personnalité: ${mockCsvData.personality.nom} (${mockCsvData.personality.style})`);
|
||
console.log(`🛡️ Anti-détection: Stack lightDefense appliqué`);
|
||
console.log(`⚡ Enhancement: Stack lightEnhancement appliqué`);
|
||
console.log(`👤 Humanisation: lightSimulation appliquée`);
|
||
|
||
// Affichage échantillon final
|
||
console.log('\n📄 === ÉCHANTILLON CONTENT FINAL ===');
|
||
contentKeys.slice(0, 2).forEach(key => {
|
||
const preview = finalContent[key].substring(0, 120) + '...';
|
||
console.log(`${key}: "${preview}"`);
|
||
});
|
||
|
||
console.log('\n🎉 PIPELINE RAPIDE 4 PHASES RÉUSSI !');
|
||
});
|
||
|
||
console.log('\n⚡ Test pipeline version rapide pour génération rapport');
|
||
console.log('📋 Workflow: Génération → Adversarial Light → Enhancement Light → Simulation Light');
|
||
console.log('🎯 Objectif: Génération AutoReporter garantie'); |