Class_generator/tests/root-cleanup/test-force-globals.js
StillHammer 29bc112c0c Unify vocabulary persistence system - remove dual systems
- Simplified loadPersistedVocabularyData() to use only VocabularyProgressManager
- Updated calculateVocabularyProgress() to use unified data structure
- Removed old system references from knowledge panel data loading
- Fixed field names (drsDiscovered, drsMastered) for unified system
- Knowledge panel now displays vocabulary progress correctly

 TESTED: Vocabulary Knowledge panel working with unified system

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-30 13:39:00 +08:00

74 lines
2.5 KiB
JavaScript

/**
* Force Global Module Initialization Test
* Run this to manually trigger global module setup
*/
window.testForceGlobals = async function() {
console.log('🔧 Force initializing global modules...');
try {
// Check if app exists
if (!window.app) {
console.error('❌ window.app not found');
return false;
}
// Check app status
const status = window.app.getStatus();
console.log('📱 App status:', status);
if (!status.isRunning) {
console.error('❌ App not running, isRunning:', status.isRunning);
return false;
}
// Get module loader
const moduleLoader = window.app.getCore().moduleLoader;
console.log('📦 ModuleLoader:', !!moduleLoader);
// Check orchestrator
const orchestrator = moduleLoader.getModule('smartPreviewOrchestrator');
console.log('🎭 Orchestrator:', !!orchestrator);
if (!orchestrator) {
console.error('❌ SmartPreviewOrchestrator not found');
return false;
}
// Check orchestrator initialization
const isInitialized = orchestrator._isInitialized;
console.log('🔄 Orchestrator initialized:', isInitialized);
// Check shared services
console.log('🔗 Checking sharedServices...');
const sharedServices = orchestrator.sharedServices;
console.log('📋 SharedServices:', sharedServices);
if (!sharedServices) {
console.error('❌ SharedServices not available');
return false;
}
// Set global variables manually
console.log('🌐 Setting global variables...');
window.unifiedDRS = moduleLoader.getModule('unifiedDRS');
window.iaEngine = sharedServices.llmValidator;
window.llmValidator = sharedServices.llmValidator;
window.prerequisiteEngine = sharedServices.prerequisiteEngine;
console.log('✅ Global variables set:');
console.log(' - contentLoader:', !!window.contentLoader);
console.log(' - unifiedDRS:', !!window.unifiedDRS);
console.log(' - iaEngine:', !!window.iaEngine);
console.log(' - llmValidator:', !!window.llmValidator);
console.log(' - prerequisiteEngine:', !!window.prerequisiteEngine);
return true;
} catch (error) {
console.error('❌ Error in force globals:', error);
return false;
}
};
console.log('🔧 Force globals test loaded. Run: testForceGlobals()');