quick-enhanced-test.js•3.51 kB
#!/usr/bin/env node
/**
* Quick Enhanced Adapters Test
* @description Quick validation of enhanced adapter functionality
*/
import {
PhysicsAdapter,
ChemistryAdapter,
HistoryAdapter,
generateEnhancedContent,
createOptimalAdapter
} from '../../src/content-generation/index.js';
async function runQuickTest() {
console.log('🧪 Quick Enhanced Adapters Test');
console.log('='.repeat(40));
try {
// Test 1: Physics Adapter Direct
console.log('\n1. Testing PhysicsAdapter directly...');
const physicsAdapter = new PhysicsAdapter();
const physicsAnalysis = await physicsAdapter.analyzeTopic('Leis de Newton e movimento');
const physicsContent = await physicsAdapter.generateContent(physicsAnalysis);
console.log(`✅ Physics content generated with ${Object.keys(physicsContent.components).length} components`);
console.log(` Enhanced features: ${physicsContent.metadata.enhancedFeatures.join(', ')}`);
// Test 2: Chemistry Adapter Direct
console.log('\n2. Testing ChemistryAdapter directly...');
const chemistryAdapter = new ChemistryAdapter();
const chemistryAnalysis = await chemistryAdapter.analyzeTopic('Ligações químicas e reações');
const chemistryContent = await chemistryAdapter.generateContent(chemistryAnalysis);
console.log(`✅ Chemistry content generated with ${Object.keys(chemistryContent.components).length} components`);
console.log(` Enhanced features: ${chemistryContent.metadata.enhancedFeatures.join(', ')}`);
// Test 3: History Adapter Direct
console.log('\n3. Testing HistoryAdapter directly...');
const historyAdapter = new HistoryAdapter();
const historyAnalysis = await historyAdapter.analyzeTopic('Revolução Francesa');
const historyContent = await historyAdapter.generateContent(historyAnalysis);
console.log(`✅ History content generated with ${Object.keys(historyContent.components).length} components`);
console.log(` Enhanced features: ${historyContent.metadata.enhancedFeatures.join(', ')}`);
// Test 4: Factory Selection
console.log('\n4. Testing factory adapter selection...');
const physicsAdapterAuto = await createOptimalAdapter('Movimento de projéteis');
console.log(` Physics topic → ${physicsAdapterAuto.constructor.name}`);
const chemistryAdapterAuto = await createOptimalAdapter('Estrutura atômica e ligações');
console.log(` Chemistry topic → ${chemistryAdapterAuto.constructor.name}`);
const historyAdapterAuto = await createOptimalAdapter('Segunda Guerra Mundial');
console.log(` History topic → ${historyAdapterAuto.constructor.name}`);
const generalAdapterAuto = await createOptimalAdapter('Técnicas de jardinagem');
console.log(` General topic → ${generalAdapterAuto.constructor.name}`);
// Test 5: Enhanced Content Generation
console.log('\n5. Testing enhanced content generation...');
const enhancedContent = await generateEnhancedContent('Termodinâmica e transferência de calor');
console.log(`✅ Enhanced content generated using ${enhancedContent.metadata.adapterUsed}`);
console.log(` Components: ${Object.keys(enhancedContent.components).join(', ')}`);
console.log('\n🎉 All quick tests passed! Enhanced adapters are working correctly.');
} catch (error) {
console.error('❌ Quick test failed:', error);
process.exit(1);
}
}
// Run quick test
await runQuickTest();