66 lines
2.4 KiB
JavaScript
66 lines
2.4 KiB
JavaScript
// Test application processor with parser integration
|
|
const SatLocApplicationProcessor = require('./helpers/satloc_application_processor');
|
|
const fs = require('fs');
|
|
|
|
async function testApplicationProcessor() {
|
|
console.log('Testing SatLoc Application Processor...\n');
|
|
|
|
try {
|
|
const processor = new SatLocApplicationProcessor();
|
|
|
|
// Create minimal context data like in the real system
|
|
const contextData = {
|
|
userId: '507f1f77bcf86cd799439011', // Mock ObjectId
|
|
jobId: '507f191e810c19729de860ea', // Mock ObjectId
|
|
taskInfo: {
|
|
aircraftId: 'TEST_AIRCRAFT_001',
|
|
pilotId: '507f191e810c19729de860eb'
|
|
},
|
|
meta: {
|
|
uploadedBy: '507f1f77bcf86cd799439011',
|
|
processingMode: 'test'
|
|
}
|
|
};
|
|
|
|
const logFileData = {
|
|
filePath: './test-logs/02220710.LOG',
|
|
buffer: fs.readFileSync('./test-logs/02220710.LOG'),
|
|
originalName: '02220710.LOG'
|
|
};
|
|
|
|
console.log(`Processing file: ${logFileData.filePath}`);
|
|
console.log(`File size: ${logFileData.buffer.length} bytes`);
|
|
console.log(`Context aircraft ID: ${contextData.taskInfo.aircraftId}\n`);
|
|
|
|
// Test the main processing method
|
|
const results = await processor.processLogFile(logFileData, contextData);
|
|
|
|
console.log('Processing Results:');
|
|
console.log(`- Success: ${results.success}`);
|
|
console.log(`- Message: ${results.message}`);
|
|
|
|
if (results.success) {
|
|
console.log(`- Applications created: ${results.applicationsCreated}`);
|
|
console.log(`- Details processed: ${results.detailsProcessed}`);
|
|
console.log(`- Work records created: ${results.workRecordsCreated}`);
|
|
|
|
if (results.utmZone) {
|
|
console.log(`- UTM Zone: ${results.utmZone.toString()}`);
|
|
}
|
|
|
|
console.log('\n✓ Application processor integration successful!');
|
|
} else {
|
|
console.log('\n✗ Processing failed');
|
|
if (results.error) {
|
|
console.log(`Error: ${results.error}`);
|
|
}
|
|
}
|
|
|
|
} catch (error) {
|
|
console.error('Error testing application processor:', error.message);
|
|
console.error('Stack:', error.stack);
|
|
}
|
|
}
|
|
|
|
// Run the test
|
|
testApplicationProcessor().catch(console.error); |