aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2022-01-04 10:40:16 +0100
committerBond_009 <bond.009@outlook.com>2022-01-04 10:40:16 +0100
commitdc222b75c55645fce521c572acebb16b278169a5 (patch)
tree5585cf4f2e47d2fcd9a62304f28937fec943cadb /tests
parentc6a1dcf420dfbb4bef80b1267fe26035e67f9a6d (diff)
Remove incorrect mime type image/jpg
Diffstat (limited to 'tests')
-rw-r--r--tests/Jellyfin.Model.Tests/Drawing/ImageFormatExtensionsTests.cs33
-rw-r--r--tests/Jellyfin.Model.Tests/Net/MimeTypesTests.cs1
2 files changed, 33 insertions, 1 deletions
diff --git a/tests/Jellyfin.Model.Tests/Drawing/ImageFormatExtensionsTests.cs b/tests/Jellyfin.Model.Tests/Drawing/ImageFormatExtensionsTests.cs
new file mode 100644
index 000000000..7c3a7ff6c
--- /dev/null
+++ b/tests/Jellyfin.Model.Tests/Drawing/ImageFormatExtensionsTests.cs
@@ -0,0 +1,33 @@
+using System;
+using System.ComponentModel;
+using MediaBrowser.Model.Drawing;
+using Xunit;
+
+namespace Jellyfin.Model.Drawing;
+
+public static class ImageFormatExtensionsTests
+{
+ private static TheoryData<ImageFormat> GetAllImageFormats()
+ {
+ var theoryTypes = new TheoryData<ImageFormat>();
+ foreach (var x in Enum.GetValues<ImageFormat>())
+ {
+ theoryTypes.Add(x);
+ }
+
+ return theoryTypes;
+ }
+
+ [Theory]
+ [MemberData(nameof(GetAllImageFormats))]
+ public static void GetMimeType_Valid_Valid(ImageFormat format)
+ => Assert.Null(Record.Exception(() => format.GetMimeType()));
+
+ [Theory]
+ [InlineData((ImageFormat)int.MinValue)]
+ [InlineData((ImageFormat)int.MaxValue)]
+ [InlineData((ImageFormat)(-1))]
+ [InlineData((ImageFormat)5)]
+ public static void GetMimeType_Valid_ThrowsInvalidEnumArgumentException(ImageFormat format)
+ => Assert.Throws<InvalidEnumArgumentException>(() => format.GetMimeType());
+}
diff --git a/tests/Jellyfin.Model.Tests/Net/MimeTypesTests.cs b/tests/Jellyfin.Model.Tests/Net/MimeTypesTests.cs
index 7b50c54b0..cbab455f0 100644
--- a/tests/Jellyfin.Model.Tests/Net/MimeTypesTests.cs
+++ b/tests/Jellyfin.Model.Tests/Net/MimeTypesTests.cs
@@ -124,7 +124,6 @@ namespace Jellyfin.Model.Tests.Net
[InlineData("font/woff2", ".woff2")]
[InlineData("image/bmp", ".bmp")]
[InlineData("image/gif", ".gif")]
- [InlineData("image/jpg", ".jpg")]
[InlineData("image/jpeg", ".jpg")]
[InlineData("image/png", ".png")]
[InlineData("image/svg+xml", ".svg")]