UNPKG

meld

Version:

Meld: A template language for LLM prompts

58 lines (47 loc) 2.01 kB
/** * API Integration Test Fix * * This script demonstrates how to properly fix the API integration tests. * The issue is with how the directive service is being initialized and * how directive handlers are registered. */ // 1. Ensure directive service properly registers handlers // See: TestContext.ts line ~137-147 // The key issue is that directive.registerDefaultHandlers() is called AFTER // directive.initialize(), but in the test, there's no verification that // the handlers are actually registered. // 2. Additional debug to track handler registration const debugHandlerRegistration = (directiveService) => { // Check that the path handler is registered const handlers = directiveService.getRegisteredHandlers(); console.log('Registered handlers:', handlers); // Verify the path handler specifically const pathHandler = handlers.find(h => h.kind === 'path'); if (!pathHandler) { console.error('Path handler not registered!'); } }; // 3. Ensure TestContext properly registers all handlers // The tests/utils/TestContext.ts initialization should call registerDefaultHandlers() // which should register all standard directive handlers. // 4. Fix for integration tests: // - Add explicit handler registration check after context initialization // - Verify AST structure before passing it to the interpreter /* // Add this debug code to integration.test.ts after context initialization beforeEach(async () => { context = new TestContext(); await context.initialize(); projectRoot = '/project'; // Debug directive service handlers console.log('Registered handlers:', Object.keys(context.services.directive.handlers) ); // Force re-registration of handlers if needed context.services.directive.registerDefaultHandlers(); // Enable path test mode context.services.path.enableTestMode(); context.services.path.setProjectPath(projectRoot); context.services.path.setHomePath('/home/user'); }); */