describe('No Duplication', function() { this.timeout(120000); it('should execute test successfully', async function() { const { expect } = require('chai'); const SatLocProcessor = require('../helpers/satloc_application_processor'); const path = require('path'); async function testProcessLogFileNoDuplication() { console.log('=== Testing processLogFile Without Duplicate Parsing ===\n'); const processor = new SatLocProcessor(); const logFilePath = path.join(__dirname, 'test-logs', 'Liquid_IF2_G4.log'); // Mock context data const contextData = { userId: 'test-user', jobId: null, uploadedDate: new Date() }; // Track parsing calls to ensure no duplication let parseCallCount = 0; const originalParseSatLocLogFile = processor.parseSatLocLogFile; processor.parseSatLocLogFile = function(...args) { parseCallCount++; console.log(`šŸ“ Parse call #${parseCallCount}: parsing log file...`); return originalParseSatLocLogFile.apply(this, args); }; try { console.log('šŸ” Testing processLogFile...'); const result = await processor.processLogFile({ filePath: logFilePath }, contextData); console.log('\nšŸ“Š Processing Results:'); console.log(`- Success: ${result.success}`); console.log(`- Parse calls made: ${parseCallCount} (should be 1)`); console.log(`- Applications created: ${result.applications?.length || 0}`); console.log(`- Application files created: ${result.applicationFiles?.length || 0}`); console.log(`- Total details: ${result.totalDetails}`); if (parseCallCount === 1) { console.log('\nāœ… SUCCESS: Log file was parsed only once!'); } else { console.log(`\nāŒ ISSUE: Log file was parsed ${parseCallCount} times (should be 1)`); } if (result.success) { console.log('āœ… SUCCESS: processLogFile completed without errors!'); } else { console.log(`āŒ ERROR: ${result.error}`); } } catch (error) { console.error('āŒ Test failed:', error.message); console.log(`Parse calls made before error: ${parseCallCount}`); } } await testProcessLogFileNoDuplication(); }); });