Files
kidsai/test-next-fundamental.js
root 500bd192d5 Initial commit: KidsAI Explorer with complete functionality
- Complete KidsAI Explorer application
- Multi-language support (English/German)
- AI-powered educational guidance using OpenAI
- Interactive chat interface for children
- Proper placeholder translation fixes
- Mobile-responsive design
- Educational framework for critical thinking
2025-07-13 16:59:42 +02:00

66 lines
2.6 KiB
JavaScript
Raw 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 script to verify the next fundamental functionality
const fetch = require('node-fetch');
const BASE_URL = 'http://localhost:3002';
async function testNextFundamental() {
console.log('🧪 Testing KidsAI next fundamental functionality...\n');
try {
// Step 1: Start conversation about rockets
console.log('1⃣ Starting conversation about rockets...');
const step1 = await fetch(`${BASE_URL}/api/ask`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
question: "Wie fliegt eine Rakete?",
language: "de"
})
});
const step1Data = await step1.json();
console.log('🤖 AI Initial Response:', step1Data.guidance?.steps?.[0]?.text || 'No response');
// Extract session ID
const sessionId = "test-session-next-fundamental-" + Date.now();
// Step 2: Continue to next fundamental
console.log('\n2⃣ Requesting next fundamental...');
const step2 = await fetch(`${BASE_URL}/api/next-fundamental`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
context: 'next_fundamental',
language: "de",
sessionId: sessionId
})
});
const step2Data = await step2.json();
console.log('\n🤖 Next Fundamental Summary:', step2Data.nextFundamental?.summary || 'No summary');
console.log('🤖 Next Fundamental Question:', step2Data.nextFundamental?.question || 'No question');
// Check if the response is appropriate
const hasValidSummary = !!step2Data.nextFundamental?.summary;
const hasValidQuestion = !!step2Data.nextFundamental?.question;
console.log('\n📊 RESULT ANALYSIS:');
console.log('✅ Received summary:', hasValidSummary);
console.log('✅ Received question:', hasValidQuestion);
console.log('🎉 FUNCTIONALITY STATUS:',
(hasValidSummary && hasValidQuestion) ? 'SUCCESS! ✅' : 'INCOMPLETE ❌');
if (hasValidSummary && hasValidQuestion) {
console.log('\n🎊 EXCELLENT! The next fundamental functionality is working correctly!');
} else {
console.log('\n❌ The functionality is not complete. Need further investigation.');
}
} catch (error) {
console.error('❌ Test failed:', error.message);
}
}
// Run the test
testNextFundamental();