Show folder names immediately and refresh stale index sizes without walking the whole drive.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
49
tests/Explorer.Application.Tests/FavoriteFoldersTests.cs
Normal file
49
tests/Explorer.Application.Tests/FavoriteFoldersTests.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using Explorer.Application;
|
||||
using Explorer.Domain;
|
||||
|
||||
namespace Explorer.Application.Tests;
|
||||
|
||||
public class FavoriteFoldersTests
|
||||
{
|
||||
[Fact]
|
||||
public void Normalize_dedupes_and_skips_virtual_roots()
|
||||
{
|
||||
var normalized = FavoriteFolders.Normalize(
|
||||
[
|
||||
@"D:\Photos\",
|
||||
@"d:\photos",
|
||||
LocationRoots.ThisPc,
|
||||
LocationRoots.Favorites,
|
||||
@"C:\Users\Dominique\Documents"
|
||||
]);
|
||||
Assert.Equal([@"D:\Photos", @"C:\Users\Dominique\Documents"], normalized);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Contains_is_case_insensitive()
|
||||
{
|
||||
var pinned = FavoriteFolders.Normalize([@"D:\Photos"]);
|
||||
Assert.True(FavoriteFolders.Contains(pinned, @"d:\photos\"));
|
||||
Assert.False(FavoriteFolders.Contains(pinned, @"D:\Other"));
|
||||
Assert.False(FavoriteFolders.Contains(pinned, LocationRoots.Home));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Add_appends_new_folders_up_to_max()
|
||||
{
|
||||
var current = Enumerable.Range(0, FavoriteFolders.MaxCount - 1).Select(i => $@"D:\F{i}");
|
||||
var next = FavoriteFolders.Add(current, [@"D:\New", @"D:\F0", @"E:\TooMany"]);
|
||||
Assert.Equal(FavoriteFolders.MaxCount, next.Count);
|
||||
Assert.Equal(@"D:\New", next[^1]);
|
||||
Assert.DoesNotContain(@"E:\TooMany", next);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Remove_unpins_without_touching_other_entries()
|
||||
{
|
||||
var next = FavoriteFolders.Remove(
|
||||
[@"D:\Photos", @"D:\Music"],
|
||||
[@"d:\photos", LocationRoots.ThisPc]);
|
||||
Assert.Equal([@"D:\Music"], next);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user