Class_generator/tests/ai-validation/test-strict-scoring.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

63 lines
2.3 KiB
JavaScript

// Test strict scoring for wrong answers
import { default as IAEngine } from './src/DRS/services/IAEngine.js';
async function testStrictScoring() {
console.log('🎯 STRICT SCORING TEST - Wrong answers should get low scores\n');
const engine = new IAEngine({
defaultProvider: 'openai',
fallbackProviders: ['deepseek']
});
await new Promise(resolve => setTimeout(resolve, 1000));
// Test cases that should get LOW scores
const wrongAnswerTests = [
{
type: 'comprehension',
test: async () => await engine.validateComprehension(
'The Amazon rainforest is the largest tropical rainforest in the world.',
'Elephants are purple animals',
{ exerciseType: 'text' }
),
description: 'Comprehension: "Elephants are purple" for Amazon rainforest'
},
{
type: 'translation',
test: async () => await engine.validateTranslation(
'Good morning',
'Pizza spaghetti',
{ fromLang: 'en', toLang: 'fr' }
),
description: 'Translation: "Pizza spaghetti" for "Good morning"'
}
];
for (const testCase of wrongAnswerTests) {
try {
console.log(`\n🧪 Testing: ${testCase.description}`);
const result = await testCase.test();
console.log(`📊 Score: ${result.score}`);
console.log(`✅ Should be <20: ${result.score < 20 ? 'PASS' : 'FAIL'}`);
console.log(`🤖 Provider: ${result.provider}`);
console.log(`💬 Feedback: ${result.feedback?.substring(0, 100)}...`);
if (result.score >= 20) {
console.log('⚠️ SCORING TOO LENIENT - This should be <20 points!');
}
} catch (error) {
console.log(`❌ Test failed: ${error.message}`);
}
await new Promise(resolve => setTimeout(resolve, 3000)); // Rate limiting
}
console.log('\n🎯 STRICT SCORING SUMMARY:');
console.log('- Completely wrong answers should score 0-20 points');
console.log('- Current prompts include explicit examples of wrong answers');
console.log('- System prompts emphasize being "strict but fair"');
}
testStrictScoring().catch(console.error);