aboutsummaryrefslogtreecommitdiff
path: root/tests/Jellyfin.Server.Integration.Tests/Controllers/FilterControllerTests.cs
diff options
context:
space:
mode:
authorCody Robibero <cody@robibe.ro>2026-11-20 07:16:33 -0500
committerGitHub <noreply@github.com>2026-11-20 07:16:33 -0500
commit00d8050bf661f6f9050a8de6e55585a8fe6d8beb (patch)
tree431104beac8e091edd3274c24caa2a1a217b79ef /tests/Jellyfin.Server.Integration.Tests/Controllers/FilterControllerTests.cs
parent8ae05ce9dcd08b870d543d8ef4f10f3c609d63df (diff)
parent2cfcb9ac0cfae50aa1a5be456fa6178cb4a2aaef (diff)
Merge pull request #18659 from LePips/update-filters-endpoints
Years, Ratings for filters endpoints
Diffstat (limited to 'tests/Jellyfin.Server.Integration.Tests/Controllers/FilterControllerTests.cs')
-rw-r--r--tests/Jellyfin.Server.Integration.Tests/Controllers/FilterControllerTests.cs35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/Jellyfin.Server.Integration.Tests/Controllers/FilterControllerTests.cs b/tests/Jellyfin.Server.Integration.Tests/Controllers/FilterControllerTests.cs
new file mode 100644
index 0000000000..0e174fb597
--- /dev/null
+++ b/tests/Jellyfin.Server.Integration.Tests/Controllers/FilterControllerTests.cs
@@ -0,0 +1,35 @@
+using System.Net.Http.Json;
+using System.Text.Json;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Jellyfin.Server.Integration.Tests.Controllers;
+
+public sealed class FilterControllerTests : IClassFixture<JellyfinApplicationFactory>
+{
+ private readonly JellyfinApplicationFactory _factory;
+ private static string? _accessToken;
+
+ public FilterControllerTests(JellyfinApplicationFactory factory)
+ {
+ _factory = factory;
+ }
+
+ [Theory]
+ [InlineData("Movie")]
+ [InlineData("Series")]
+ public async Task GetQueryFilters_EmptyLibrary_SerializesEmptyArrays(string itemType)
+ {
+ using var client = _factory.CreateClient();
+ client.DefaultRequestHeaders.AddAuthHeader(_accessToken ??= await AuthHelper.CompleteStartupAsync(client));
+
+ var filters = await client.GetFromJsonAsync<JsonElement>($"/Items/Filters2?includeItemTypes={itemType}", TestContext.Current.CancellationToken);
+
+ foreach (var field in new[] { "Years", "OfficialRatings", "Genres", "Tags", "AudioLanguages", "SubtitleLanguages" })
+ {
+ var values = filters.GetProperty(field);
+ Assert.Equal(JsonValueKind.Array, values.ValueKind);
+ Assert.Equal(0, values.GetArrayLength());
+ }
+ }
+}