common: simplify normalizing IMDb Id and add tests

This commit is contained in:
Bogdan
2023-05-21 12:09:32 +03:00
parent e29f409164
commit c6f4a55444
17 changed files with 53 additions and 27 deletions

View File

@@ -94,5 +94,22 @@ namespace Jackett.Test.Common.Utils
{
ParseUtil.GetLongFromString(original).Should().Be(parsedInt);
}
[TestCase("tt0183790", "tt0183790")]
[TestCase("0183790", "tt0183790")]
[TestCase("183790", "tt0183790")]
[TestCase("tt10001870", "tt10001870")]
[TestCase("10001870", "tt10001870")]
[TestCase("tt", null)]
[TestCase("tt0", null)]
[TestCase("abc", null)]
[TestCase("abc0", null)]
[TestCase("0", null)]
[TestCase("", null)]
[TestCase(null, null)]
public void should_parse_full_imdb_id_from_string(string input, string expected)
{
ParseUtil.GetFullImdbId(input).Should().Be(expected);
}
}
}