#!/usr/bin/env node /** * IntelliSense Case Sensitivity Test * Tests the fix for case sensitivity issues in the library IntelliSense feature * This test verifies that paths with different case are properly matched on Linux systems */ import fs from 'fs'; import path from 'path'; import { fileURLToPath } from 'url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); // Helper function to normalize paths for case-insensitive comparison function normalizePathForComparison(filePath) { return filePath.toLowerCase(); } console.log('๐Ÿงช Testing IntelliSense Case Sensitivity Fix...'); // Test case sensitivity normalization const testPaths = [ '/mnt/Media/Library', '/mnt/media/library', '/mnt/MEDIA/LIBRARY', '/mnt/Media/library' ]; console.log('\n๐Ÿ“ Test Paths:'); testPaths.forEach(p => console.log(` ${p}`)); // Create normalized set for comparison const normalizedLibraryPaths = new Set(testPaths.map(p => normalizePathForComparison(p))); console.log('\n๐Ÿ”„ Normalized Paths:'); Array.from(normalizedLibraryPaths).forEach(p => console.log(` ${p}`)); // Test matching with different case variations const testCases = [ { path: '/mnt/media/library', expected: true, description: 'Exact lowercase match' }, { path: '/mnt/Media/Library', expected: true, description: 'Exact uppercase match' }, { path: '/mnt/MEDIA/LIBRARY', expected: true, description: 'All caps match' }, { path: '/mnt/Media/library', expected: true, description: 'Mixed case match' }, { path: '/mnt/different/path', expected: false, description: 'Non-matching path' } ]; console.log('\n๐Ÿ” Testing Path Matching:'); let passedTests = 0; let totalTests = testCases.length; testCases.forEach((testCase, index) => { const normalizedTestPath = normalizePathForComparison(testCase.path); const isMatch = normalizedLibraryPaths.has(normalizedTestPath); const passed = isMatch === testCase.expected; console.log(` Test ${index + 1}: ${testCase.description}`); console.log(` Path: ${testCase.path}`); console.log(` Normalized: ${normalizedTestPath}`); console.log(` Expected: ${testCase.expected}, Got: ${isMatch}`); console.log(` Result: ${passed ? 'โœ… PASS' : 'โŒ FAIL'}`); if (passed) passedTests++; console.log(''); }); console.log(`\n๐Ÿ“Š Test Results: ${passedTests}/${totalTests} tests passed`); if (passedTests === totalTests) { console.log('โœ… All tests passed! Case sensitivity fix is working correctly.'); process.exit(0); } else { console.log('โŒ Some tests failed. Case sensitivity fix needs attention.'); process.exit(1); }