diff options
| author | Shadowghost <Ghost_of_Stone@web.de> | 2026-05-12 22:50:16 +0200 |
|---|---|---|
| committer | Shadowghost <Ghost_of_Stone@web.de> | 2026-05-12 22:50:16 +0200 |
| commit | 8f7c54ee5ef8647bc049499819606ad7946378ec (patch) | |
| tree | 4411b82fd0d0660a426b869a5781782e6dee7500 /tests/Jellyfin.Server.Implementations.Tests/Localization | |
| parent | 5e82b61bab8c9461624fd2095fc9ccd11e33ce8d (diff) | |
| parent | e9942c385775f33c70dbb4b910085ae2c563e898 (diff) | |
Merge remote-tracking branch 'upstream/master' into search-rebased
Diffstat (limited to 'tests/Jellyfin.Server.Implementations.Tests/Localization')
| -rw-r--r-- | tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs b/tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs index 5bcfc580ff..acabaf3acb 100644 --- a/tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs +++ b/tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs @@ -242,6 +242,40 @@ namespace Jellyfin.Server.Implementations.Tests.Localization } [Theory] + [InlineData("US:INVALID", "US")] // Colon separator, known country code, unknown rating + [InlineData("us:INVALID", "US")] // Colon separator, lowercase country code + [InlineData("DE-INVALID", "US")] // Hyphen separator, known language prefix, unknown rating + [InlineData("ca:INVALID", "US")] // Colon separator, known country code (Canada) + public async Task GetRatingScore_UnknownRatingWithKnownCountry_ReturnsNull(string rating, string countryCode) + { + var localizationManager = Setup(new ServerConfiguration + { + MetadataCountryCode = countryCode + }); + await localizationManager.LoadAll(); + + Assert.Null(localizationManager.GetRatingScore(rating)); + } + + [Theory] + [InlineData("us:R", "DE", 17, 0)] // Colon separator, explicit US country, valid US rating + [InlineData("US:PG-13", "DE", 13, 0)] // Colon separator, explicit US country, valid US rating + [InlineData("ca:R", "US", 18, 1)] // Colon separator, Canada country code, valid CA rating + public async Task GetRatingScore_ValidRatingWithCountrySeparator_ReturnsScore(string rating, string countryCode, int expectedScore, int? expectedSubScore) + { + var localizationManager = Setup(new ServerConfiguration + { + MetadataCountryCode = countryCode + }); + await localizationManager.LoadAll(); + + var score = localizationManager.GetRatingScore(rating); + Assert.NotNull(score); + Assert.Equal(expectedScore, score.Score); + Assert.Equal(expectedSubScore, score.SubScore); + } + + [Theory] [InlineData("Default", "Default")] [InlineData("HeaderLiveTV", "Live TV")] public void GetLocalizedString_Valid_Success(string key, string expected) |
