mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-04-27 12:02:51 -04:00
v1.4.1: MAJOR FIX - Moved from Redis to Valkey, added migration service to support, Utilizing Hi-Fi API 2.7 with ISRC search, preserve local item json objects, add a quality fallback, added "transcoding" support that just reduces the fetched quality, while still downloading at the quality set in the .env, introduced real-time download visualizer on web-ui (not complete), move some stuff from json to redis, better retry logic, configurable timeouts per provider
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
using allstarr.Services.Common;
|
||||
|
||||
namespace allstarr.Tests;
|
||||
|
||||
public class InjectedPlaylistItemHelperTests
|
||||
{
|
||||
[Fact]
|
||||
public void LooksLikeSyntheticLocalItem_ReturnsTrue_ForLocalAllstarrItem()
|
||||
{
|
||||
var item = new Dictionary<string, object?>
|
||||
{
|
||||
["Id"] = "49cf417c0fe00ad9cb1ed59f2debc384",
|
||||
["ServerId"] = "allstarr"
|
||||
};
|
||||
|
||||
Assert.True(InjectedPlaylistItemHelper.LooksLikeSyntheticLocalItem(item));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LooksLikeSyntheticLocalItem_ReturnsFalse_ForExternalInjectedItem()
|
||||
{
|
||||
var item = new Dictionary<string, object?>
|
||||
{
|
||||
["Id"] = "ext-spotify-4h4QlmocP3IuwYEj2j14p8",
|
||||
["ServerId"] = "allstarr"
|
||||
};
|
||||
|
||||
Assert.False(InjectedPlaylistItemHelper.LooksLikeSyntheticLocalItem(item));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LooksLikeSyntheticLocalItem_ReturnsFalse_ForRawJellyfinItem()
|
||||
{
|
||||
var item = new Dictionary<string, object?>
|
||||
{
|
||||
["Id"] = "49cf417c0fe00ad9cb1ed59f2debc384",
|
||||
["ServerId"] = "c17d351d3af24c678a6d8049c212d522"
|
||||
};
|
||||
|
||||
Assert.False(InjectedPlaylistItemHelper.LooksLikeSyntheticLocalItem(item));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LooksLikeLocalItemMissingGenreMetadata_ReturnsTrue_ForRawJellyfinItemMissingGenreItems()
|
||||
{
|
||||
var item = new Dictionary<string, object?>
|
||||
{
|
||||
["Id"] = "49cf417c0fe00ad9cb1ed59f2debc384",
|
||||
["ServerId"] = "c17d351d3af24c678a6d8049c212d522",
|
||||
["Genres"] = new[] { "Pop" }
|
||||
};
|
||||
|
||||
Assert.True(InjectedPlaylistItemHelper.LooksLikeLocalItemMissingGenreMetadata(item));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LooksLikeLocalItemMissingGenreMetadata_ReturnsFalse_WhenGenresAndGenreItemsExist()
|
||||
{
|
||||
var item = new Dictionary<string, object?>
|
||||
{
|
||||
["Id"] = "49cf417c0fe00ad9cb1ed59f2debc384",
|
||||
["ServerId"] = "c17d351d3af24c678a6d8049c212d522",
|
||||
["Genres"] = new[] { "Pop" },
|
||||
["GenreItems"] = new[]
|
||||
{
|
||||
new Dictionary<string, object?> { ["Name"] = "Pop", ["Id"] = "genre-id" }
|
||||
}
|
||||
};
|
||||
|
||||
Assert.False(InjectedPlaylistItemHelper.LooksLikeLocalItemMissingGenreMetadata(item));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LooksLikeLocalItemMissingGenreMetadata_ReturnsFalse_ForExternalInjectedItem()
|
||||
{
|
||||
var item = new Dictionary<string, object?>
|
||||
{
|
||||
["Id"] = "ext-spotify-4h4QlmocP3IuwYEj2j14p8",
|
||||
["ServerId"] = "allstarr",
|
||||
["Genres"] = new[] { "Pop" }
|
||||
};
|
||||
|
||||
Assert.False(InjectedPlaylistItemHelper.LooksLikeLocalItemMissingGenreMetadata(item));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user