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).
35 lines
1.3 KiB
C#
35 lines
1.3 KiB
C#
using ErrorOr;
|
|
using Musify.Application.Albums;
|
|
using Musify.Application.Tests.TestSupport;
|
|
using Xunit;
|
|
|
|
namespace Musify.Application.Tests.Albums
|
|
{
|
|
public sealed class GetAlbumsByUserIdQueryHandlerTests : HandlerTestBase
|
|
{
|
|
private GetAlbumsByUserIdQueryHandler CreateHandler() => new(Database);
|
|
|
|
[Fact]
|
|
public async Task Handle_UserWithAlbums_ReturnsOnlyTheirAlbums()
|
|
{
|
|
var owner = TestEntities.User(1, "owner");
|
|
var other = TestEntities.User(2, "other");
|
|
await SeedAsync(owner, other, TestEntities.Album(owner.Id, "Mine"), TestEntities.Album(other.Id, "Theirs"));
|
|
|
|
var result = await CreateHandler().Handle(new GetAlbumsByUserIdQuery(owner.Id, PageNumber: 1, PageSize: 10), TestContext.Current.CancellationToken);
|
|
|
|
Assert.False(result.IsError);
|
|
var album = Assert.Single(result.Value.Items);
|
|
Assert.Equal("Mine", album.Title);
|
|
}
|
|
|
|
[Fact]
|
|
public async Task Handle_UserMissing_ReturnsNotFound()
|
|
{
|
|
var result = await CreateHandler().Handle(new GetAlbumsByUserIdQuery(404, PageNumber: 1, PageSize: 10), TestContext.Current.CancellationToken);
|
|
|
|
Assert.Equal(ErrorType.NotFound, result.FirstError.Type);
|
|
}
|
|
}
|
|
}
|