ML-169.10.1: Add delete coverage

Cover current delete behavior across LiveView index and show paths, and strengthen existing delete tests with persistence assertions.\n\nValidation: mise run dev:precommit
This commit is contained in:
Claudio Ortolina
2026-05-20 18:04:29 +01:00
parent 981099511f
commit 23960b5b23
12 changed files with 241 additions and 1 deletions
@@ -17,6 +17,7 @@ defmodule MusicLibraryWeb.ArtistLive.ShowTest do
alias MusicLibrary.Artists
alias MusicLibrary.Assets
alias MusicLibrary.Assets.Asset
alias MusicLibrary.Records
alias Req.Test
defp fill_collection(_config) do
@@ -164,6 +165,26 @@ defmodule MusicLibraryWeb.ArtistLive.ShowTest do
|> refute_has("#collection p", escape(other_collection_record.title))
|> refute_has("#wishlist p", escape(other_collection_record.title))
end
test "deletes a record from the artist record list", %{
conn: conn,
collection_record: collection_record,
artist_musicbrainz_id: artist_musicbrainz_id
} do
stub_last_fm(%{})
conn
|> visit(~p"/artists/#{artist_musicbrainz_id}")
|> render_async()
|> assert_has("#collection p", escape(collection_record.title))
|> click_link("a[data-confirm='Are you sure?']", "Delete")
|> refute_has("#collection p", escape(collection_record.title))
|> assert_has("#toast-group", "Record deleted")
assert_raise Ecto.NoResultsError, fn ->
Records.get_record!(collection_record.id)
end
end
end
describe "Edit artist image" do