// Test the folder population logic const testBookmarks = [ { id: 1, title: "Test 1", url: "https://example.com", folder: "Development" }, { id: 2, title: "Test 2", url: "https://example2.com", folder: "Development / Tools" }, { id: 3, title: "Test 3", url: "https://example3.com", folder: "Personal" }, { id: 4, title: "Test 4", url: "https://example4.com", folder: "Development" }, { id: 5, title: "Test 5", url: "https://example5.com", folder: "" }, { id: 6, title: "Test 6", url: "https://example6.com", folder: "Personal / Finance" } ]; // Simulate the populateFolderList logic function testPopulateFolderList(bookmarks) { // Get unique folder names from existing bookmarks const uniqueFolders = [...new Set( bookmarks .map(bookmark => bookmark.folder) .filter(folder => folder && folder.trim() !== '') )].sort(); console.log('Test Bookmarks:', bookmarks.length); console.log('Unique Folders Found:', uniqueFolders); console.log('Expected Folders: ["Development", "Development / Tools", "Personal", "Personal / Finance"]'); // Verify the logic const expectedFolders = ["Development", "Development / Tools", "Personal", "Personal / Finance"]; const isCorrect = JSON.stringify(uniqueFolders) === JSON.stringify(expectedFolders); console.log('Test Result:', isCorrect ? '✅ PASS' : '❌ FAIL'); return uniqueFolders; } // Run the test testPopulateFolderList(testBookmarks);