30 lines
1006 B
JavaScript
30 lines
1006 B
JavaScript
#!/usr/bin/env node
|
|
|
|
const { extractJobIdFromFileName, hasJobIdPattern, getSupportedPatterns } = require('./helpers/satloc_util');
|
|
|
|
// Test different filename patterns
|
|
const testFilenames = [
|
|
'JOB146 HK4704.log',
|
|
'2507140724SatlocG4_b4ef.log',
|
|
'2508021622SatlocG4_8948A.log',
|
|
'20250915_JOB789_field1.log',
|
|
'2025091512 CROP001.log',
|
|
'random_file_name.log',
|
|
'invalid.log'
|
|
];
|
|
|
|
console.log('=== Filename Job ID Extraction Test ===\n');
|
|
|
|
testFilenames.forEach(filename => {
|
|
const jobId = extractJobIdFromFileName(filename);
|
|
const hasPattern = hasJobIdPattern(filename);
|
|
console.log(`Filename: ${filename.padEnd(30)} => Job ID: ${jobId || 'Not found'} | Has Pattern: ${hasPattern}`);
|
|
});
|
|
|
|
console.log('\n=== Supported Patterns ===');
|
|
const patterns = getSupportedPatterns();
|
|
patterns.forEach((pattern, index) => {
|
|
console.log(`${index + 1}. ${pattern.name}: ${pattern.format}`);
|
|
console.log(` Example: ${pattern.example}`);
|
|
console.log(` Description: ${pattern.description}\n`);
|
|
}); |