44 lines
1.5 KiB
C#
44 lines
1.5 KiB
C#
using ClaudeDo.Ui.ViewModels.Modals;
|
|
|
|
namespace ClaudeDo.Ui.Tests;
|
|
|
|
public class DiffFileIconsTests
|
|
{
|
|
[Theory]
|
|
[InlineData("src/Foo.cs", "mdi:LanguageCsharp")]
|
|
[InlineData("Views/A.axaml", "mdi:CodeTags")]
|
|
[InlineData("a.xaml", "mdi:CodeTags")]
|
|
[InlineData("a.xml", "mdi:CodeTags")]
|
|
[InlineData("package.json", "mdi:CodeJson")]
|
|
[InlineData("README.md", "mdi:LanguageMarkdownOutline")]
|
|
[InlineData("X.csproj", "mdi:FileCogOutline")]
|
|
[InlineData("ClaudeDo.slnx", "mdi:FileCogOutline")]
|
|
[InlineData("run.ps1", "mdi:Powershell")]
|
|
[InlineData("build.sh", "mdi:Console")]
|
|
[InlineData("logo.png", "mdi:FileImageOutline")]
|
|
public void ForPath_MapsKnownExtensions(string path, string expected)
|
|
=> Assert.Equal(expected, DiffFileIcons.ForPath(path));
|
|
|
|
[Theory]
|
|
[InlineData("Foo.CS")]
|
|
[InlineData("A.AXAML")]
|
|
public void ForPath_IsCaseInsensitive(string path)
|
|
=> Assert.NotEqual("mdi:FileOutline", DiffFileIcons.ForPath(path));
|
|
|
|
[Theory]
|
|
[InlineData("Dockerfile")]
|
|
[InlineData("notes.unknownext")]
|
|
[InlineData("")]
|
|
public void ForPath_FallsBackToGenericFile(string path)
|
|
=> Assert.Equal("mdi:FileOutline", DiffFileIcons.ForPath(path));
|
|
|
|
[Fact]
|
|
public void FolderIcon_FollowsIsExpanded()
|
|
{
|
|
var dir = new DiffTreeNodeViewModel { Name = "src", IsDirectory = true };
|
|
Assert.Equal("mdi:FolderOpen", dir.IconKey);
|
|
dir.IsExpanded = false;
|
|
Assert.Equal("mdi:Folder", dir.IconKey);
|
|
}
|
|
}
|