Streamline test suite

record_set_live/index_test.exs — Removed 3 describe blocks ("Delete set", "Remove record from set", "Drag-and-drop reorder") that were duplicated in ShowTest. Removed 3 tests.

record_set_live/show_test.exs — Replaced context-level assertion in "Remove record" with UI assertion (refute has_element?). Removed redundant assert_raise from "Delete set" (kept assert_redirect).

scrobble_rules_live/index_test.exs — Removed "Form validation" describe block (2 tests duplicated in "saves new scrobble_rule" and changeset tests). Kept the "updates form labels" test, moved into "Index"
  block. Replaced ScrobbleRules.get_scrobble_rule! assertions in toggle test with UI assertions checking button text.
online_store_template_live/index_test.exs — Replaced context-level assertions with UI assertions in Create, Edit, Delete, and Toggle tests. Removed OnlineStoreTemplates alias.

scrobbled_tracks_live/index_test.exs — Collapsed 3 search tests into 1. Removed 2 tests.
This commit is contained in:
Claudio Ortolina
2026-03-09 18:55:07 +00:00
parent 3ddb287187
commit f86800368d
5 changed files with 42 additions and 157 deletions
@@ -49,7 +49,7 @@ defmodule MusicLibraryWeb.ScrobbledTracksLiveTest do
describe "Search functionality" do
setup [:create_multiple_tracks]
test "searches tracks by title", %{conn: conn} do
test "filters results by search query", %{conn: conn} do
track_fixture(%{title: "Unique Track Title"})
session = visit(conn, ~p"/scrobbled-tracks")
@@ -62,34 +62,6 @@ defmodule MusicLibraryWeb.ScrobbledTracksLiveTest do
end)
|> assert_has("p", "Unique Track Title")
end
test "searches tracks by artist name", %{conn: conn} do
track_fixture(%{artist_name: "Unique Artist Name"})
session = visit(conn, ~p"/scrobbled-tracks")
session
|> unwrap(fn view ->
view
|> form("form[phx-submit='search']", %{query: "Unique Artist"})
|> render_submit()
end)
|> assert_has("p", "Unique Artist Name")
end
test "searches tracks by album title", %{conn: conn} do
track_fixture(%{album_title: "Unique Album Title"})
session = visit(conn, ~p"/scrobbled-tracks")
session
|> unwrap(fn view ->
view
|> form("form[phx-submit='search']", %{query: "Unique Album"})
|> render_submit()
end)
|> assert_has("p", "Unique Album Title")
end
end
describe "Edit track" do