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).
38 lines
1.3 KiB
C#
38 lines
1.3 KiB
C#
using ErrorOr;
|
|
using Musify.Application.Tests.TestSupport;
|
|
using Musify.Application.Tracks;
|
|
using Musify.Application.Tracks.Responses;
|
|
using Xunit;
|
|
|
|
namespace Musify.Application.Tests.Tracks
|
|
{
|
|
public sealed class GetTrackByIdQueryHandlerTests : HandlerTestBase
|
|
{
|
|
private GetTrackByIdQueryHandler CreateHandler() => new(Database);
|
|
|
|
[Fact]
|
|
public async Task Handle_LocalTrack_ReturnsItWithOwnerAsArtist()
|
|
{
|
|
var owner = TestEntities.User(1, "artist-name");
|
|
var track = TestEntities.Track(owner, "My Song");
|
|
await SeedAsync(owner, track);
|
|
|
|
var result = await CreateHandler().Handle(new GetTrackByIdQuery(track.Id), TestContext.Current.CancellationToken);
|
|
|
|
Assert.False(result.IsError);
|
|
Assert.Equal("My Song", result.Value.Title);
|
|
Assert.Equal(owner.Name, result.Value.Artist);
|
|
var localResponse = Assert.IsType<TrackApplicationResponse>(result.Value);
|
|
Assert.Equal(owner.Id, localResponse.OwnerUserId);
|
|
}
|
|
|
|
[Fact]
|
|
public async Task Handle_TrackMissing_ReturnsNotFound()
|
|
{
|
|
var result = await CreateHandler().Handle(new GetTrackByIdQuery(Guid.NewGuid()), TestContext.Current.CancellationToken);
|
|
|
|
Assert.Equal(ErrorType.NotFound, result.FirstError.Type);
|
|
}
|
|
}
|
|
}
|