Use stored scrobbled tracks

This commit is contained in:
Claudio Ortolina
2025-05-31 21:36:05 +01:00
parent 32956ca593
commit 1703f1cf70
5 changed files with 39 additions and 46 deletions
+8 -2
View File
@@ -1,5 +1,5 @@
defmodule LastFm.FeedTest do
use ExUnit.Case, async: true
use MusicLibrary.DataCase
alias LastFm.{Album, Artist, Feed, Track}
@@ -46,7 +46,13 @@ defmodule LastFm.FeedTest do
test "it returns tracks in descending order of scrobble" do
:ok = Feed.update([@track_two, @track_one])
assert [@track_two, @track_one] == Feed.all_tracks()
track_two_scrobbled_at_uts = @track_two.scrobbled_at_uts
track_one_scrobbled_at_uts = @track_one.scrobbled_at_uts
assert [
%{scrobbled_at_uts: ^track_two_scrobbled_at_uts},
%{scrobbled_at_uts: ^track_one_scrobbled_at_uts}
] = Feed.all_tracks(10)
end
end
end