Browse Source

add test for new uniqueid nfo key normalisation

KGT1 1 week ago
parent
commit
e28d547006

+ 19 - 0
tests/Jellyfin.XbmcMetadata.Tests/Parsers/MovieNfoParserTests.cs

@@ -275,5 +275,24 @@ namespace Jellyfin.XbmcMetadata.Tests.Parsers
             Assert.StartsWith(">>", item.Overview, StringComparison.InvariantCulture);
             Assert.StartsWith(">>", item.Overview, StringComparison.InvariantCulture);
             Assert.EndsWith("<<", item.Overview, StringComparison.InvariantCulture);
             Assert.EndsWith("<<", item.Overview, StringComparison.InvariantCulture);
         }
         }
+
+        [Fact]
+        public void Parse_TmdbcolUniqueId_NormalizedToTmdbCollection()
+        {
+            var result = new MetadataResult<Video>()
+            {
+                Item = new Movie()
+            };
+
+            _parser.Fetch(result, "Test Data/Lilo & Stitch.nfo", CancellationToken.None);
+            var item = (Movie)result.Item;
+
+            // Verify that <uniqueid type="tmdbcol"> is normalized to TmdbCollection
+            Assert.True(item.ProviderIds.ContainsKey(MetadataProvider.TmdbCollection.ToString()));
+            Assert.Equal("97020", item.ProviderIds[MetadataProvider.TmdbCollection.ToString()]);
+
+            // Verify that the lowercase "tmdbcol" is NOT in the provider IDs
+            Assert.False(item.ProviderIds.ContainsKey("tmdbcol"));
+        }
     }
     }
 }
 }

+ 1 - 0
tests/Jellyfin.XbmcMetadata.Tests/Test Data/Lilo & Stitch.nfo

@@ -2,6 +2,7 @@
 <movie>
 <movie>
   <title>Lilo &amp; Stitch</title>
   <title>Lilo &amp; Stitch</title>
   <originaltitle>Lilo &amp; Stitch</originaltitle>
   <originaltitle>Lilo &amp; Stitch</originaltitle>
+  <uniqueid type="tmdbcol" default="false">97020</uniqueid>
   <set>Lilo &amp; Stitch Collection</set>
   <set>Lilo &amp; Stitch Collection</set>
   <plot>&gt;&gt;As Stitch, a runaway genetic experiment from a faraway planet, wreaks havoc on the Hawaiian Islands, he becomes the mischievous adopted alien "puppy" of an independent little girl named Lilo and learns about loyalty, friendship, and ʻohana, the Hawaiian tradition of family.&lt;&lt;</plot>
   <plot>&gt;&gt;As Stitch, a runaway genetic experiment from a faraway planet, wreaks havoc on the Hawaiian Islands, he becomes the mischievous adopted alien "puppy" of an independent little girl named Lilo and learns about loyalty, friendship, and ʻohana, the Hawaiian tradition of family.&lt;&lt;</plot>
 </movie>
 </movie>