Add ex_slop, configure it, run it and fix issues
This commit is contained in:
@@ -209,7 +209,6 @@ defmodule MusicLibrary.ScrobbleRulesTest do
|
||||
|
||||
assert {:ok, 1} = ScrobbleRules.apply_album_rule(rule)
|
||||
|
||||
# Verify the matching track was updated
|
||||
updated_track = Repo.get_by(Track, scrobbled_at_uts: track1.scrobbled_at_uts)
|
||||
assert updated_track.album.musicbrainz_id == rule.target_musicbrainz_id
|
||||
end
|
||||
@@ -232,7 +231,6 @@ defmodule MusicLibrary.ScrobbleRulesTest do
|
||||
|
||||
assert {:ok, 1} = ScrobbleRules.apply_artist_rule(rule)
|
||||
|
||||
# Verify the matching track was updated
|
||||
updated_track = Repo.get_by(Track, scrobbled_at_uts: track1.scrobbled_at_uts)
|
||||
assert updated_track.artist.musicbrainz_id == rule.target_musicbrainz_id
|
||||
end
|
||||
@@ -359,17 +357,14 @@ defmodule MusicLibrary.ScrobbleRulesTest do
|
||||
album: %{musicbrainz_id: "", title: "Wish You Were Here"}
|
||||
})
|
||||
|
||||
# Create a non-matching track
|
||||
_track3 =
|
||||
scrobbled_track_fixture(%{
|
||||
scrobbled_at_uts: System.system_time(:second) + 2,
|
||||
album: %{musicbrainz_id: "", title: "The Wall"}
|
||||
})
|
||||
|
||||
# Apply both rules at once
|
||||
assert {:ok, 2} = ScrobbleRules.apply_all_album_rules([rule1, rule2])
|
||||
|
||||
# Verify both tracks were updated by fetching them again
|
||||
updated_track1 = Repo.get(Track, track1.scrobbled_at_uts)
|
||||
assert updated_track1.album.musicbrainz_id == rule1.target_musicbrainz_id
|
||||
|
||||
@@ -400,7 +395,6 @@ defmodule MusicLibrary.ScrobbleRulesTest do
|
||||
artist: %{musicbrainz_id: "", name: "Led Zeppelin"}
|
||||
})
|
||||
|
||||
# Create a non-matching track
|
||||
_track3 =
|
||||
scrobbled_track_fixture(%{
|
||||
scrobbled_at_uts: System.system_time(:second) + 2,
|
||||
|
||||
@@ -8,11 +8,9 @@ defmodule MusicLibrary.Worker.PruneAssetCacheTest do
|
||||
@describetag :capture_log
|
||||
|
||||
test "prunes old cache entries" do
|
||||
# Insert a cache entry with an old timestamp
|
||||
old_timestamp = DateTime.utc_now() |> DateTime.add(-8, :day) |> DateTime.to_unix()
|
||||
:ets.insert(Cache, {{"old_payload", "image/jpeg"}, old_timestamp, "old_content"})
|
||||
|
||||
# Insert a recent cache entry
|
||||
Cache.set("recent_payload", "image/jpeg", "recent_content")
|
||||
|
||||
assert :ok = perform_job(PruneAssetCache, %{})
|
||||
|
||||
@@ -56,7 +56,6 @@ defmodule MusicLibraryWeb.ScrobbleLive.IndexTest do
|
||||
|
||||
session
|
||||
|> unwrap(fn view ->
|
||||
# Process the {:perform_search, query} message
|
||||
render(view)
|
||||
end)
|
||||
|> assert_has("input[value='marbles']")
|
||||
@@ -73,7 +72,6 @@ defmodule MusicLibraryWeb.ScrobbleLive.IndexTest do
|
||||
|> form("form[phx-submit='search']", %{query: "marbles"})
|
||||
|> render_submit()
|
||||
|
||||
# Process the {:perform_search, query} message
|
||||
render(view)
|
||||
end)
|
||||
|> assert_has("h3", "Release Groups")
|
||||
@@ -103,16 +101,13 @@ defmodule MusicLibraryWeb.ScrobbleLive.IndexTest do
|
||||
|> form("form[phx-submit='search']", %{query: "marbles"})
|
||||
|> render_submit()
|
||||
|
||||
# Process search results
|
||||
render(view)
|
||||
|
||||
# Click on a release group
|
||||
view
|
||||
|> render_click("select_release_group", %{
|
||||
"release_group_id" => release_group_id
|
||||
})
|
||||
|
||||
# Process the {:fetch_releases, release_group} message
|
||||
render(view)
|
||||
end)
|
||||
|> assert_has("h3", "Releases for")
|
||||
|
||||
@@ -37,7 +37,6 @@ defmodule MusicLibraryWeb.ScrobbledTracksLiveTest do
|
||||
end
|
||||
|
||||
test "shows empty state when no tracks", %{conn: conn} do
|
||||
# Delete the created track
|
||||
ListeningStats.delete_track(track_fixture())
|
||||
|
||||
conn
|
||||
|
||||
@@ -47,7 +47,6 @@ defmodule MusicLibraryWeb.RecordsOnThisDayEmailTest do
|
||||
end
|
||||
|
||||
test "skips sending when no records match" do
|
||||
# Create a record with a release date that won't match
|
||||
Fixtures.Records.record(%{release_date: "2020-01-01"})
|
||||
|
||||
date = ~D[2025-06-15]
|
||||
|
||||
@@ -1,19 +1,5 @@
|
||||
defmodule MusicLibraryWeb.ConnCase do
|
||||
@moduledoc """
|
||||
This module defines the test case to be used by
|
||||
tests that require setting up a connection.
|
||||
|
||||
Such tests rely on `Phoenix.ConnTest` and also
|
||||
import other functionality to make it easier
|
||||
to build common data structures and query the data layer.
|
||||
|
||||
Finally, if the test case interacts with the database,
|
||||
we enable the SQL sandbox, so changes done to the database
|
||||
are reverted at the end of every test. If you are using
|
||||
PostgreSQL, you can even run database tests asynchronously
|
||||
by setting `use MusicLibraryWeb.ConnCase, async: true`, although
|
||||
this option is not recommended for other databases.
|
||||
"""
|
||||
@moduledoc false
|
||||
|
||||
use ExUnit.CaseTemplate
|
||||
|
||||
|
||||
@@ -1,18 +1,5 @@
|
||||
defmodule MusicLibrary.DataCase do
|
||||
@moduledoc """
|
||||
This module defines the setup for tests requiring
|
||||
access to the application's data layer.
|
||||
|
||||
You may define functions here to be used as helpers in
|
||||
your tests.
|
||||
|
||||
Finally, if the test case interacts with the database,
|
||||
we enable the SQL sandbox, so changes done to the database
|
||||
are reverted at the end of every test. If you are using
|
||||
PostgreSQL, you can even run database tests asynchronously
|
||||
by setting `use MusicLibrary.DataCase, async: true`, although
|
||||
this option is not recommended for other databases.
|
||||
"""
|
||||
@moduledoc false
|
||||
|
||||
use ExUnit.CaseTemplate
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
defmodule MusicLibrary.ArtistInfoFixtures do
|
||||
@moduledoc """
|
||||
This module defines test helpers for creating
|
||||
entities via the `MusicLibrary.Artists.ArtistInfo` schema.
|
||||
"""
|
||||
@moduledoc false
|
||||
|
||||
alias MusicLibrary.Artists.ArtistInfo
|
||||
alias MusicLibrary.Repo
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
defmodule MusicLibrary.Fixtures.OnlineStoreTemplates do
|
||||
@moduledoc """
|
||||
This module defines test helpers for creating
|
||||
entities via the `MusicLibrary.OnlineStoreTemplates` context.
|
||||
"""
|
||||
@moduledoc false
|
||||
|
||||
alias MusicLibrary.OnlineStoreTemplates
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
defmodule MusicLibrary.Fixtures.RecordSets do
|
||||
@moduledoc """
|
||||
This module defines test helpers for creating
|
||||
entities via the `MusicLibrary.RecordSets` context.
|
||||
"""
|
||||
@moduledoc false
|
||||
|
||||
alias MusicLibrary.RecordSets
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
defmodule MusicLibrary.Fixtures.Records do
|
||||
@moduledoc """
|
||||
This module defines test helpers for creating
|
||||
entities via the `MusicLibrary.Records` context.
|
||||
"""
|
||||
@moduledoc false
|
||||
|
||||
alias MusicBrainz.Fixtures.ReleaseGroup
|
||||
alias MusicLibrary.Assets
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
defmodule MusicLibrary.ScrobbleRulesFixtures do
|
||||
@moduledoc """
|
||||
This module defines test helpers for creating
|
||||
entities via the `MusicLibrary.ScrobbleRules` context.
|
||||
"""
|
||||
@moduledoc false
|
||||
|
||||
alias MusicLibrary.ScrobbleRules
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
defmodule MusicLibrary.ScrobbledTracksFixtures do
|
||||
@moduledoc """
|
||||
This module defines test helpers for creating
|
||||
scrobbled track entities via the database.
|
||||
"""
|
||||
@moduledoc false
|
||||
|
||||
alias LastFm.Track
|
||||
alias MusicLibrary.Repo
|
||||
|
||||
Reference in New Issue
Block a user