// Test with cache disabled to get fresh AI responses import { default as IAEngine } from './src/DRS/services/IAEngine.js'; async function testNoCacheStrictScoring() { console.log('🎯 FRESH TEST - No cache, strict scoring validation\n'); // Create new engine instance to avoid cache const engine = new IAEngine({ defaultProvider: 'openai', fallbackProviders: ['deepseek'] }); // Clear any existing cache engine.cache?.clear(); await new Promise(resolve => setTimeout(resolve, 1000)); console.log('🧪 Testing wrong answers (should get <20 points):\n'); // Test 1: Text comprehension - completely wrong try { console.log('1️⃣ Text Analysis: "Elephants are purple" for Amazon rainforest'); const result1 = await engine.validateComprehension( 'The Amazon rainforest is the largest tropical rainforest in the world.', 'Elephants are purple animals', { exerciseType: 'text' } ); console.log(` Score: ${result1.score} (should be <20: ${result1.score < 20 ? 'PASS' : 'FAIL'})`); console.log(` Provider: ${result1.provider}`); } catch (error) { console.log(` ❌ Failed: ${error.message}`); } await new Promise(resolve => setTimeout(resolve, 3000)); // Test 2: Translation - completely wrong try { console.log('\n2️⃣ Translation: "Pizza spaghetti" for "Good morning"'); const result2 = await engine.validateTranslation( 'Good morning', 'Pizza spaghetti', { fromLang: 'en', toLang: 'fr' } ); console.log(` Score: ${result2.score} (should be <20: ${result2.score < 20 ? 'PASS' : 'FAIL'})`); console.log(` Provider: ${result2.provider}`); } catch (error) { console.log(` ❌ Failed: ${error.message}`); } await new Promise(resolve => setTimeout(resolve, 3000)); console.log('\n🧪 Testing correct answers (should get >70 points):\n'); // Test 3: Good comprehension try { console.log('3️⃣ Text Analysis: "Amazon is the biggest rainforest" for Amazon rainforest'); const result3 = await engine.validateComprehension( 'The Amazon rainforest is the largest tropical rainforest in the world.', 'Amazon is the biggest rainforest', { exerciseType: 'text' } ); console.log(` Score: ${result3.score} (should be >70: ${result3.score > 70 ? 'PASS' : 'FAIL'})`); console.log(` Provider: ${result3.provider}`); } catch (error) { console.log(` ❌ Failed: ${error.message}`); } await new Promise(resolve => setTimeout(resolve, 3000)); // Test 4: Good translation try { console.log('\n4️⃣ Translation: "Bonjour" for "Good morning"'); const result4 = await engine.validateTranslation( 'Good morning', 'Bonjour', { fromLang: 'en', toLang: 'fr' } ); console.log(` Score: ${result4.score} (should be >70: ${result4.score > 70 ? 'PASS' : 'FAIL'})`); console.log(` Provider: ${result4.provider}`); } catch (error) { console.log(` ❌ Failed: ${error.message}`); } console.log('\n🎯 FRESH TEST SUMMARY:'); console.log('✅ If all tests PASS, the strict scoring is working correctly'); console.log('❌ If tests FAIL, the prompts need further adjustment'); } testNoCacheStrictScoring().catch(console.error);