aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorStepan <ste.martinek+git@gmail.com>2020-11-12 13:16:33 +0100
committerStepan <ste.martinek+git@gmail.com>2020-11-12 13:16:33 +0100
commit3bca1181b3c91115e693dc83ba1f5fdd6ee38f7c (patch)
treede19caca448c37dc64ffdd43944ad9abf36def2e /tests
parent496923719c405cd9b0386f7d31fcb204cdaeb9c4 (diff)
Taken suggestions from code review and created test for ExtraRuleType.Regex instead of throwing exception there.
Diffstat (limited to 'tests')
-rw-r--r--tests/Jellyfin.Naming.Tests/Video/CleanDateTimeTests.cs4
-rw-r--r--tests/Jellyfin.Naming.Tests/Video/ExtraTests.cs14
2 files changed, 8 insertions, 10 deletions
diff --git a/tests/Jellyfin.Naming.Tests/Video/CleanDateTimeTests.cs b/tests/Jellyfin.Naming.Tests/Video/CleanDateTimeTests.cs
index ed971eed7..15cb5c72f 100644
--- a/tests/Jellyfin.Naming.Tests/Video/CleanDateTimeTests.cs
+++ b/tests/Jellyfin.Naming.Tests/Video/CleanDateTimeTests.cs
@@ -1,4 +1,4 @@
-using System.IO;
+using System.IO;
using Emby.Naming.Common;
using Emby.Naming.Video;
using Xunit;
@@ -51,6 +51,8 @@ namespace Jellyfin.Naming.Tests.Video
[InlineData("My Movie 2013-12-09", "My Movie 2013-12-09", null)]
[InlineData("My Movie 20131209", "My Movie 20131209", null)]
[InlineData("My Movie 2013-12-09 2013", "My Movie 2013-12-09", 2013)]
+ [InlineData(null, null, null)]
+ [InlineData("", "", null)]
public void CleanDateTimeTest(string input, string expectedName, int? expectedYear)
{
input = Path.GetFileName(input);
diff --git a/tests/Jellyfin.Naming.Tests/Video/ExtraTests.cs b/tests/Jellyfin.Naming.Tests/Video/ExtraTests.cs
index 12a9b023b..d34f65409 100644
--- a/tests/Jellyfin.Naming.Tests/Video/ExtraTests.cs
+++ b/tests/Jellyfin.Naming.Tests/Video/ExtraTests.cs
@@ -96,17 +96,13 @@ namespace Jellyfin.Naming.Tests.Video
}
[Fact]
- public void TestExtraInfo_InvalidRuleMediaType()
- {
- var options = new NamingOptions { VideoExtraRules = new[] { new ExtraRule(ExtraType.Unknown, ExtraRuleType.DirectoryName, " ", MediaType.Photo) } };
- Assert.Throws<InvalidOperationException>(() => GetExtraTypeParser(options).GetExtraInfo("sample.jpg"));
- }
-
- [Fact]
public void TestExtraInfo_InvalidRuleType()
{
- var options = new NamingOptions { VideoExtraRules = new[] { new ExtraRule(ExtraType.Unknown, ExtraRuleType.Regex, " ", MediaType.Video) } };
- Assert.Throws<InvalidOperationException>(() => GetExtraTypeParser(options).GetExtraInfo("sample.mp4"));
+ var rule = new ExtraRule(ExtraType.Unknown, ExtraRuleType.Regex, @"([eE]x(tra)?\.\w+)", MediaType.Video);
+ var options = new NamingOptions { VideoExtraRules = new[] { rule } };
+ var res = GetExtraTypeParser(options).GetExtraInfo("extra.mp4");
+
+ Assert.Equal(rule, res.Rule);
}
[Fact]