Move refresh config and callers to ListeningStats

This commit is contained in:
Claudio Ortolina
2026-03-27 23:14:09 +00:00
parent fa5e13f303
commit 61dd3f45c7
12 changed files with 23 additions and 40 deletions
-3
View File
@@ -6,8 +6,6 @@ defmodule LastFm.ConfigTest do
assert %LastFm.Config{
api_key: api_key,
user: user,
auto_refresh: false,
refresh_interval: refresh_interval,
user_agent: user_agent
} =
LastFm.Config.resolve(:music_library)
@@ -15,7 +13,6 @@ defmodule LastFm.ConfigTest do
assert is_binary(api_key)
assert is_binary(user)
assert is_binary(user_agent)
assert is_integer(refresh_interval)
end
end
end
+5 -4
View File
@@ -1,7 +1,8 @@
defmodule LastFm.FeedTest do
use MusicLibrary.DataCase
alias LastFm.{Album, Artist, Feed, Track}
alias LastFm.{Album, Artist, Track}
alias MusicLibrary.ListeningStats
@track_one %Track{
musicbrainz_id: "5689211e-9afa-3c3e-8e34-63dc0de45ef1",
@@ -38,13 +39,13 @@ defmodule LastFm.FeedTest do
describe "update and broadcast" do
test "stores the track and broadcasts the updated track count" do
:ok = Feed.subscribe()
:ok = ListeningStats.subscribe()
assert {:ok, 2} == Feed.update([@track_two, @track_one])
assert {:ok, 2} == ListeningStats.update([@track_two, @track_one])
assert_receive %{track_count: 2}
# Tracks have already been inserted, count of new tracks is 0
assert {:ok, 0} == Feed.update([@track_two, @track_one])
assert {:ok, 0} == ListeningStats.update([@track_two, @track_one])
assert_receive %{track_count: 0}
end
end