Class_generator/test-dragon-pearl.js
StillHammer fe7153d28b Fix compatibility system and improve UX
- Add intelligent content-game compatibility system with visual badges
- Fix Adventure Reader to work with Dragon's Pearl content structure
- Implement multi-column games grid for faster navigation
- Add pronunciation display for Chinese vocabulary and sentences
- Fix navigation breadcrumb to show proper hierarchy (Home > Levels > Content)
- Add back buttons to all navigation pages
- Improve JSONContentLoader to preserve story structure
- Add comprehensive debugging and diagnostic tools

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-18 19:29:21 +08:00

59 lines
2.2 KiB
JavaScript

// === TEST AVEC DRAGON'S PEARL ===
// Simuler l'environnement browser
global.window = {};
global.document = {};
global.logSh = (msg, level) => console.log(`[${level}] ${msg}`);
// Charger les modules
const fs = require('fs');
const path = require('path');
// Charger le système de compatibilité
const compatibilityCode = fs.readFileSync(path.join(__dirname, 'js/core/content-game-compatibility.js'), 'utf8');
eval(compatibilityCode);
// Charger le contenu Dragon's Pearl
const dragonPearlCode = fs.readFileSync(path.join(__dirname, 'js/content/chinese-long-story.js'), 'utf8');
eval(dragonPearlCode);
console.log('🐉 Test avec Dragon\'s Pearl\n');
try {
const checker = new window.ContentGameCompatibility();
const dragonPearlContent = window.ContentModules.ChineseLongStory;
console.log('📦 Contenu Dragon\'s Pearl:');
console.log(` Nom: ${dragonPearlContent.name}`);
console.log(` Description: ${dragonPearlContent.description}`);
console.log(` Difficulté: ${dragonPearlContent.difficulty}`);
console.log(` Vocabulaire: ${Object.keys(dragonPearlContent.vocabulary || {}).length} mots`);
console.log(` Story: ${dragonPearlContent.story ? 'Oui' : 'Non'}`);
console.log('\n🎮 Tests de compatibilité:');
const games = ['whack-a-mole', 'memory-match', 'quiz-game', 'fill-the-blank', 'text-reader', 'adventure-reader'];
games.forEach(game => {
const result = checker.checkCompatibility(dragonPearlContent, game);
const status = result.compatible ? '✅' : '❌';
console.log(` ${status} ${game}: ${result.score}% - ${result.reason}`);
});
console.log('\n💡 Suggestions pour jeux incompatibles:');
games.forEach(game => {
const result = checker.checkCompatibility(dragonPearlContent, game);
if (!result.compatible) {
const suggestions = checker.getImprovementSuggestions(dragonPearlContent, game);
if (suggestions.length > 0) {
console.log(` 📝 ${game}:`);
suggestions.forEach(suggestion => {
console.log(` 💡 ${suggestion}`);
});
}
}
});
} catch (error) {
console.error('❌ Erreur:', error.message);
console.error(error.stack);
}