Move refresh config and callers to ListeningStats
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -225,7 +225,7 @@ defmodule MusicLibraryWeb.StatsLive.IndexTest do
|
||||
last_fm_data: %{}
|
||||
}
|
||||
|
||||
LastFm.Feed.update([
|
||||
MusicLibrary.ListeningStats.update([
|
||||
machinarium_soundtrack_track,
|
||||
the_last_flight_track,
|
||||
the_mystery_of_time_track,
|
||||
|
||||
Reference in New Issue
Block a user