- Create complete integration test system (test-integration.js) - Add UI/UX interaction testing with real event simulation (test-uiux-integration.js) - Implement end-to-end scenario testing for user journeys (test-e2e-scenarios.js) - Add console testing commands for rapid development testing (test-console-commands.js) - Create comprehensive test guide documentation (TEST-GUIDE.md) - Integrate test buttons in debug panel (F12 → 3 test types) - Add vocabulary modal two-progress-bar system integration - Fix flashcard retry system for "don't know" cards - Update IntelligentSequencer for task distribution validation 🧪 Testing Coverage: - 35+ integration tests (architecture/modules) - 20+ UI/UX tests (real user interactions) - 5 E2E scenarios (complete user journeys) - Console commands for rapid testing - Debug panel integration 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
89 lines
3.4 KiB
JavaScript
89 lines
3.4 KiB
JavaScript
// 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); |