Drops the YouTube-backed second catalog source entirely: the Local/External split on Track/Album collapses into single concrete entities, Artist/TrackArtist/ExternalTrack/ExternalAlbum and the YouTube service/download pipeline (yt-dlp, MassTransit consumer, routing slip) are deleted, and mixes now source discovery only from local listening history. Includes the RemoveYouTubeIntegration EF Core migration and matching Worker/deploy/compose cleanup (no more yt-dlp/python/deno in the Worker image, no thumbnail-cache/YtDlp config sections).
40 lines
1.6 KiB
C#
40 lines
1.6 KiB
C#
using ErrorOr;
|
|
using Musify.Application.PlayLists;
|
|
using Musify.Application.Tests.TestSupport;
|
|
using Musify.Domain.Entities;
|
|
using Xunit;
|
|
|
|
namespace Musify.Application.Tests.PlayLists
|
|
{
|
|
public sealed class GetPlayListTracksQueryHandlerTests : HandlerTestBase
|
|
{
|
|
private GetPlayListTracksQueryHandler CreateHandler() => new(Database);
|
|
|
|
[Fact]
|
|
public async Task Handle_TracksOrderedByPosition_ReturnsThemInOrder()
|
|
{
|
|
var owner = TestEntities.User();
|
|
var playList = TestEntities.PlayList(owner.Id);
|
|
var second = TestEntities.Track(owner, "Second");
|
|
var first = TestEntities.Track(owner, "First");
|
|
await SeedAsync(
|
|
owner, playList, second, first,
|
|
new PlayListHasTrack { PlayListId = playList.Id, TrackId = second.Id, Position = 1 },
|
|
new PlayListHasTrack { PlayListId = playList.Id, TrackId = first.Id, Position = 0 });
|
|
|
|
var result = await CreateHandler().Handle(new GetPlayListTracksQuery(playList.Id, PageNumber: 1, PageSize: 10), TestContext.Current.CancellationToken);
|
|
|
|
Assert.False(result.IsError);
|
|
Assert.Equal(["First", "Second"], result.Value.Items.Select(track => track.Title));
|
|
}
|
|
|
|
[Fact]
|
|
public async Task Handle_PlayListMissing_ReturnsNotFound()
|
|
{
|
|
var result = await CreateHandler().Handle(new GetPlayListTracksQuery(Guid.NewGuid(), PageNumber: 1, PageSize: 10), TestContext.Current.CancellationToken);
|
|
|
|
Assert.Equal(ErrorType.NotFound, result.FirstError.Type);
|
|
}
|
|
}
|
|
}
|