Class_generator/tests/ai-validation/test-variance-quick.js
StillHammer f5cef0c913 Add comprehensive testing suite with UI/UX and E2E integration tests
- 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>
2025-09-28 23:04:38 +08:00

102 lines
3.4 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Test rapide de variance avec une seule instance
import { default as IAEngine } from './src/DRS/services/IAEngine.js';
async function testVarianceQuick() {
console.log('⚡ TEST RAPIDE DE VARIANCE - Contenus très différents\n');
const engine = new IAEngine({
defaultProvider: 'openai',
fallbackProviders: ['deepseek']
});
await new Promise(resolve => setTimeout(resolve, 1000));
// Tests avec contenus complètement différents pour éviter cache
const quickTests = [
{
name: 'WRONG: Science -> Nonsense',
test: () => engine.validateComprehension(
'Albert Einstein developed the theory of relativity in the early 20th century.',
'Dancing unicorns eat rainbow cookies in space',
{ exerciseType: 'physics-comprehension' }
),
expected: 'LOW'
},
{
name: 'CORRECT: History understanding',
test: () => engine.validateComprehension(
'World War II ended in 1945 when Japan surrendered after atomic bombs.',
'World War 2 finished in 1945 when Japan gave up after nuclear attacks',
{ exerciseType: 'history-analysis' }
),
expected: 'HIGH'
},
{
name: 'WRONG: French translation nonsense',
test: () => engine.validateTranslation(
'Where is the library?',
'Elephant potato singing moon',
{ fromLang: 'en', toLang: 'fr', context: 'directions' }
),
expected: 'LOW'
},
{
name: 'CORRECT: Spanish translation',
test: () => engine.validateTranslation(
'What time is it?',
'¿Qué hora es?',
{ fromLang: 'en', toLang: 'es', context: 'time' }
),
expected: 'HIGH'
}
];
const results = [];
for (const test of quickTests) {
try {
console.log(`🧪 ${test.name}`);
const result = await test.test();
const appropriate = (test.expected === 'LOW' && result.score <= 30) ||
(test.expected === 'HIGH' && result.score >= 70);
console.log(` Score: ${result.score} (expected ${test.expected})`);
console.log(` ✅ Appropriate: ${appropriate ? 'YES' : 'NO'}`);
console.log(` Provider: ${result.provider}\n`);
results.push({
name: test.name,
score: result.score,
expected: test.expected,
appropriate: appropriate
});
} catch (error) {
console.log(` ❌ Error: ${error.message}\n`);
}
await new Promise(resolve => setTimeout(resolve, 4000));
}
// Quick summary
const passed = results.filter(r => r.appropriate).length;
const total = results.length;
console.log('🎯 QUICK VARIANCE TEST RESULTS:');
console.log(`Passed: ${passed}/${total} (${Math.round((passed/total)*100)}%)`);
results.forEach(r => {
console.log(`${r.appropriate ? '✅' : '❌'} ${r.name}: ${r.score} (${r.expected})`);
});
if (passed === total) {
console.log('\n🎉 SCORING SYSTEM WORKING PERFECTLY!');
} else {
console.log('\n⚠ Some inconsistencies detected');
}
return results;
}
testVarianceQuick().catch(console.error);