diff options
| author | Quyet Vu <72632257+quyet-v@users.noreply.github.com> | 2025-03-31 16:39:51 +1300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-30 21:39:51 -0600 |
| commit | 2ace8803453b235b0b0ae29f0069f9e5a3c069c8 (patch) | |
| tree | 577be35d5efbc012050409c38df85200e636d0ca /tests | |
| parent | d7b786e7778c42a02b9fad2024ce4eea9af035a6 (diff) | |
Fix playlist order (#13730)
* Fix playlist order move
* Remove extra space
* Added more test cases
* Change namespace to file-scoped
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Jellyfin.Server.Implementations.Tests/Playlists/PlaylistManagerTests.cs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/Jellyfin.Server.Implementations.Tests/Playlists/PlaylistManagerTests.cs b/tests/Jellyfin.Server.Implementations.Tests/Playlists/PlaylistManagerTests.cs new file mode 100644 index 000000000..cc8ca720e --- /dev/null +++ b/tests/Jellyfin.Server.Implementations.Tests/Playlists/PlaylistManagerTests.cs @@ -0,0 +1,40 @@ +using Emby.Server.Implementations.Playlists; +using Xunit; + +namespace Jellyfin.Server.Implementations.Tests.Playlists; + +public class PlaylistManagerTests +{ + [Fact] + public void DetermineAdjustedIndexMoveToFirstPositionNoPriorInAllList() + { + var priorIndexAllChildren = 0; + var newIndex = 0; + + var adjustedIndex = PlaylistManager.DetermineAdjustedIndex(priorIndexAllChildren, newIndex); + + Assert.Equal(0, adjustedIndex); + } + + [Fact] + public void DetermineAdjustedIndexPriorInMiddleOfAllList() + { + var priorIndexAllChildren = 2; + var newIndex = 0; + + var adjustedIndex = PlaylistManager.DetermineAdjustedIndex(priorIndexAllChildren, newIndex); + + Assert.Equal(1, adjustedIndex); + } + + [Fact] + public void DetermineAdjustedIndexMoveMiddleOfPlaylist() + { + var priorIndexAllChildren = 2; + var newIndex = 1; + + var adjustedIndex = PlaylistManager.DetermineAdjustedIndex(priorIndexAllChildren, newIndex); + + Assert.Equal(3, adjustedIndex); + } +} |
