Remove "it" from the test descriptions

This commit is contained in:
Claudio Ortolina
2026-03-27 08:38:41 +00:00
parent b9e3de1db6
commit 1301f888f3
16 changed files with 43 additions and 43 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ defmodule DiscogsTest do
alias Discogs.Fixtures alias Discogs.Fixtures
describe "get_artist/1" do describe "get_artist/1" do
test "it returns the artist" do test "returns the artist" do
discogs_id = "discogs_id" discogs_id = "discogs_id"
expected_info = expected_info =
+1 -1
View File
@@ -37,7 +37,7 @@ defmodule LastFm.FeedTest do
} }
describe "update and broadcast" do describe "update and broadcast" do
test "it stores the track and broadcasts the updated track count" do test "stores the track and broadcasts the updated track count" do
:ok = Feed.subscribe() :ok = Feed.subscribe()
assert {:ok, 2} == Feed.update([@track_two, @track_one]) assert {:ok, 2} == Feed.update([@track_two, @track_one])
+2 -2
View File
@@ -4,7 +4,7 @@ defmodule LastFmTest do
alias LastFm.{Artist, Fixtures, Scrobble} alias LastFm.{Artist, Fixtures, Scrobble}
describe "get_artist_info/1" do describe "get_artist_info/1" do
test "it returns the artist info" do test "returns the artist info" do
name = "Steven Wilson" name = "Steven Wilson"
musicbrainz_id = Ecto.UUID.generate() musicbrainz_id = Ecto.UUID.generate()
@@ -22,7 +22,7 @@ defmodule LastFmTest do
end end
describe "scrobble/2" do describe "scrobble/2" do
test "it returns the scrobbled track" do test "returns the scrobbled track" do
scrobbles = [ scrobbles = [
%Scrobble{ %Scrobble{
track: "Wonderland", track: "Wonderland",
+2 -2
View File
@@ -4,7 +4,7 @@ defmodule MusicBrainz.ReleaseTest do
alias MusicBrainz.{Fixtures, Release} alias MusicBrainz.{Fixtures, Release}
describe "release_duration/1" do describe "release_duration/1" do
test "it returns the total milliseconds" do test "returns the total milliseconds" do
release = release =
Fixtures.Release.release_with_media(:marbles) Fixtures.Release.release_with_media(:marbles)
|> Release.from_api_response() |> Release.from_api_response()
@@ -12,7 +12,7 @@ defmodule MusicBrainz.ReleaseTest do
assert Release.release_duration(release) == 5_933_595 assert Release.release_duration(release) == 5_933_595
end end
test "it handles empty durations" do test "handles empty durations" do
release = release =
Fixtures.Release.release_with_media(:marbles) Fixtures.Release.release_with_media(:marbles)
|> put_in(["media", Access.all(), "tracks", Access.all(), "length"], nil) |> put_in(["media", Access.all(), "tracks", Access.all(), "length"], nil)
+2 -2
View File
@@ -7,7 +7,7 @@ defmodule MusicBrainzTest do
alias MusicBrainz.ReleaseGroupSearchResult alias MusicBrainz.ReleaseGroupSearchResult
describe "search_release_group/2" do describe "search_release_group/2" do
test "it returns results with correct limit and offset" do test "returns results with correct limit and offset" do
results = release_group_search_results() results = release_group_search_results()
expected_results = expected_results =
@@ -26,7 +26,7 @@ defmodule MusicBrainzTest do
end end
describe "search_release_by_barcode/1" do describe "search_release_by_barcode/1" do
test "it returns releases belonging to the same release group" do test "returns releases belonging to the same release group" do
barcode = "5052205070023" barcode = "5052205070023"
releases = releases =
+3 -3
View File
@@ -6,7 +6,7 @@ defmodule MusicLibrary.ArtistsTest do
alias MusicLibrary.Artists alias MusicLibrary.Artists
describe "get_artist/1" do describe "get_artist/1" do
test "it returns records with essential data" do test "returns records with essential data" do
record = record() record = record()
[expected] = record.artists [expected] = record.artists
@@ -17,7 +17,7 @@ defmodule MusicLibrary.ArtistsTest do
end end
describe "get_all_artist_ids/0" do describe "get_all_artist_ids/0" do
test "it returns unique artist IDs" do test "returns unique artist IDs" do
marillion_record = record_with_artist("Marillion") marillion_record = record_with_artist("Marillion")
_another_marillion_record = record_with_artist("Marillion") _another_marillion_record = record_with_artist("Marillion")
steven_wilson_record = record_with_artist("Steven Wilson") steven_wilson_record = record_with_artist("Steven Wilson")
@@ -83,7 +83,7 @@ defmodule MusicLibrary.ArtistsTest do
end end
describe "refresh_artist_info/1" do describe "refresh_artist_info/1" do
test "it stores musicbrainz and discogs data" do test "stores musicbrainz and discogs data" do
steven_wilson_musicbrainz_id = "3a51b862-0144-40f6-aa17-6aaeefea29d9" steven_wilson_musicbrainz_id = "3a51b862-0144-40f6-aa17-6aaeefea29d9"
Req.Test.stub(MusicBrainz.API, fn conn -> Req.Test.stub(MusicBrainz.API, fn conn ->
+1 -1
View File
@@ -4,7 +4,7 @@ defmodule MusicLibrary.Assets.ImageTest do
alias MusicLibrary.Assets.Image alias MusicLibrary.Assets.Image
describe "resize/1" do describe "resize/1" do
test "it resizes to the desired size" do test "resizes to the desired size" do
# Use the cached cover data which is much faster than reading from disk # Use the cached cover data which is much faster than reading from disk
cover_data = Image.fallback_data() cover_data = Image.fallback_data()
{:ok, resized_cover} = Image.resize(cover_data) {:ok, resized_cover} = Image.resize(cover_data)
+1 -1
View File
@@ -97,7 +97,7 @@ defmodule MusicLibrary.Records.RecordTest do
end end
describe "add_musicbrainz_data/2" do describe "add_musicbrainz_data/2" do
test "it updates release_ids and included_release_group_ids" do test "updates release_ids and included_release_group_ids" do
record = %Record{} record = %Record{}
assert record.release_ids == [] assert record.release_ids == []
assert record.included_release_group_ids == [] assert record.included_release_group_ids == []
+2 -2
View File
@@ -23,11 +23,11 @@ defmodule MusicLibrary.WishlistTest do
assert [%{title: "Brave"}, %{title: "Brave"}] = Wishlist.search_records("brave") assert [%{title: "Brave"}, %{title: "Brave"}] = Wishlist.search_records("brave")
end end
test "it respects limit" do test "respects limit" do
assert [%{title: "Brave"}] = Wishlist.search_records("brave", limit: 1) assert [%{title: "Brave"}] = Wishlist.search_records("brave", limit: 1)
end end
test "it respects offset" do test "respects offset" do
[first_match] = Wishlist.search_records("brave", limit: 1) [first_match] = Wishlist.search_records("brave", limit: 1)
[second_match] = Wishlist.search_records("brave", limit: 1, offset: 1) [second_match] = Wishlist.search_records("brave", limit: 1, offset: 1)
assert first_match !== second_match assert first_match !== second_match
@@ -15,13 +15,13 @@ defmodule MusicLibraryWeb.CollectionControllerTest do
describe "GET /api/collection/latest" do describe "GET /api/collection/latest" do
setup [:create_record] setup [:create_record]
test "it requires authentication", %{conn: conn} do test "requires authentication", %{conn: conn} do
conn = get(conn, ~p"/api/collection/latest") conn = get(conn, ~p"/api/collection/latest")
assert conn.status == 401 assert conn.status == 401
end end
test "it returns the latest record", %{conn: conn, record: record} do test "returns the latest record", %{conn: conn, record: record} do
conn = conn =
conn conn
|> put_req_header("authorization", "Bearer #{api_token()}") |> put_req_header("authorization", "Bearer #{api_token()}")
@@ -34,14 +34,14 @@ defmodule MusicLibraryWeb.CollectionControllerTest do
describe "GET /api/collection/random" do describe "GET /api/collection/random" do
setup [:create_record] setup [:create_record]
test "it requires authentication", %{conn: conn} do test "requires authentication", %{conn: conn} do
conn = get(conn, ~p"/api/collection/random") conn = get(conn, ~p"/api/collection/random")
assert conn.status == 401 assert conn.status == 401
end end
# We're not testing random here - the query is solid enough # We're not testing random here - the query is solid enough
test "it returns a random record", %{conn: conn, record: record} do test "returns a random record", %{conn: conn, record: record} do
conn = conn =
conn conn
|> put_req_header("authorization", "Bearer #{api_token()}") |> put_req_header("authorization", "Bearer #{api_token()}")
@@ -54,13 +54,13 @@ defmodule MusicLibraryWeb.CollectionControllerTest do
describe "GET /api/collection" do describe "GET /api/collection" do
setup [:create_record] setup [:create_record]
test "it requires authentication", %{conn: conn} do test "requires authentication", %{conn: conn} do
conn = get(conn, ~p"/api/collection") conn = get(conn, ~p"/api/collection")
assert conn.status == 401 assert conn.status == 401
end end
test "it returns a paginated list of records", %{conn: conn, record: record} do test "returns a paginated list of records", %{conn: conn, record: record} do
conn = conn =
conn conn
|> put_req_header("authorization", "Bearer #{api_token()}") |> put_req_header("authorization", "Bearer #{api_token()}")
@@ -78,13 +78,13 @@ defmodule MusicLibraryWeb.CollectionControllerTest do
describe "GET /api/collection/on_this_day" do describe "GET /api/collection/on_this_day" do
setup [:create_record] setup [:create_record]
test "it requires authentication", %{conn: conn} do test "requires authentication", %{conn: conn} do
conn = get(conn, ~p"/api/collection/on_this_day") conn = get(conn, ~p"/api/collection/on_this_day")
assert conn.status == 401 assert conn.status == 401
end end
test "it returns a list of records", %{conn: conn, record: record} do test "returns a list of records", %{conn: conn, record: record} do
conn = conn =
conn conn
|> put_req_header("authorization", "Bearer #{api_token()}") |> put_req_header("authorization", "Bearer #{api_token()}")
@@ -3,7 +3,7 @@ defmodule MusicLibraryWeb.SessionControllerTest do
describe "GET /login" do describe "GET /login" do
@tag :logged_out @tag :logged_out
test "it shows the login form", %{conn: conn} do test "shows the login form", %{conn: conn} do
conn = get(conn, "/login") conn = get(conn, "/login")
response = html_response(conn, 200) response = html_response(conn, 200)
@@ -12,7 +12,7 @@ defmodule MusicLibraryWeb.SessionControllerTest do
assert response =~ "Login" assert response =~ "Login"
end end
test "it resets the session", %{conn: conn} do test "resets the session", %{conn: conn} do
conn = get(conn, "/login") conn = get(conn, "/login")
session = get_session(conn) session = get_session(conn)
@@ -23,7 +23,7 @@ defmodule MusicLibraryWeb.SessionControllerTest do
describe "POST /sessions/create" do describe "POST /sessions/create" do
@tag :logged_out @tag :logged_out
test "it refuses an invalid password", %{conn: conn} do test "refuses an invalid password", %{conn: conn} do
conn = post(conn, ~p"/sessions/create", %{"password" => "wrong password"}) conn = post(conn, ~p"/sessions/create", %{"password" => "wrong password"})
{"location", location} = {"location", location} =
@@ -39,7 +39,7 @@ defmodule MusicLibraryWeb.SessionControllerTest do
end end
@tag :logged_out @tag :logged_out
test "it accepts a valid password", %{conn: conn} do test "accepts a valid password", %{conn: conn} do
valid_password = valid_password =
Application.get_env(:music_library, MusicLibraryWeb) Application.get_env(:music_library, MusicLibraryWeb)
|> Keyword.fetch!(:login_password) |> Keyword.fetch!(:login_password)
@@ -26,7 +26,7 @@ defmodule MusicLibraryWeb.ArtistLive.ShowTest do
describe "Show artist" do describe "Show artist" do
setup :fill_collection setup :fill_collection
test "it shows the artist bio and play count", %{ test "shows the artist bio and play count", %{
conn: conn, conn: conn,
artist_musicbrainz_id: artist_musicbrainz_id artist_musicbrainz_id: artist_musicbrainz_id
} do } do
@@ -47,7 +47,7 @@ defmodule MusicLibraryWeb.ArtistLive.ShowTest do
|> assert_has("dt", "Biography") |> assert_has("dt", "Biography")
end end
test "it gracefully handles errors in fetching bio and play count", %{ test "gracefully handles errors in fetching bio and play count", %{
conn: conn, conn: conn,
artist_musicbrainz_id: artist_musicbrainz_id artist_musicbrainz_id: artist_musicbrainz_id
} do } do
@@ -69,7 +69,7 @@ defmodule MusicLibraryWeb.ArtistLive.ShowTest do
|> assert_has("div", "Error loading biography") |> assert_has("div", "Error loading biography")
end end
test "it shows the artist country and MB id", %{ test "shows the artist country and MB id", %{
conn: conn, conn: conn,
artist_musicbrainz_id: artist_musicbrainz_id artist_musicbrainz_id: artist_musicbrainz_id
} do } do
@@ -91,7 +91,7 @@ defmodule MusicLibraryWeb.ArtistLive.ShowTest do
|> assert_has("code", artist_musicbrainz_id) |> assert_has("code", artist_musicbrainz_id)
end end
test "it shows records from the collection and the wishlist", %{ test "shows records from the collection and the wishlist", %{
conn: conn, conn: conn,
collection_record: collection_record, collection_record: collection_record,
artist_musicbrainz_id: artist_musicbrainz_id artist_musicbrainz_id: artist_musicbrainz_id
@@ -244,7 +244,7 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do
end end
describe "Adding a new record" do describe "Adding a new record" do
test "it shows the import modal", %{conn: conn} do test "shows the import modal", %{conn: conn} do
conn conn
|> visit(~p"/collection") |> visit(~p"/collection")
|> click_link("Add") |> click_link("Add")
@@ -253,7 +253,7 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do
|> assert_path(~p"/collection/import") |> assert_path(~p"/collection/import")
end end
test "it imports a record when selected", %{conn: conn} do test "imports a record when selected", %{conn: conn} do
release_group_search_results = Map.get(release_group_search_results(), "release-groups") release_group_search_results = Map.get(release_group_search_results(), "release-groups")
first_release_group_search_result = hd(release_group_search_results) first_release_group_search_result = hd(release_group_search_results)
@@ -343,7 +343,7 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do
end end
describe "Add via barcode scan" do describe "Add via barcode scan" do
test "it tracks the camera status", %{conn: conn} do test "tracks the camera status", %{conn: conn} do
session = session =
conn conn
|> visit(~p"/collection/scan") |> visit(~p"/collection/scan")
@@ -361,7 +361,7 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do
|> assert_has("video#camera-preview") |> assert_has("video#camera-preview")
end end
test "it adds a record after scanning", %{conn: conn} do test "adds a record after scanning", %{conn: conn} do
barcode = "5037300650128" barcode = "5037300650128"
releases = releases(:marbles) releases = releases(:marbles)
@@ -28,7 +28,7 @@ defmodule MusicLibraryWeb.CollectionLive.ShowTest do
end end
describe "Show record" do describe "Show record" do
test "it includes all needed information", %{conn: conn} do test "includes all needed information", %{conn: conn} do
record = record() record = record()
transform = %Transform{hash: record.cover_hash, width: nil} transform = %Transform{hash: record.cover_hash, width: nil}
payload = Transform.encode!(transform) payload = Transform.encode!(transform)
@@ -28,7 +28,7 @@ defmodule MusicLibraryWeb.StatsLive.IndexTest do
describe "Stats home page" do describe "Stats home page" do
setup [:fill_collection, :fill_wishlist] setup [:fill_collection, :fill_wishlist]
test "it shows the collection counts (total, format, and type)", %{ test "shows the collection counts (total, format, and type)", %{
conn: conn, conn: conn,
collection: collection collection: collection
} do } do
@@ -52,7 +52,7 @@ defmodule MusicLibraryWeb.StatsLive.IndexTest do
end) end)
end end
test "it shows the latest purchase", %{conn: conn, collection: collection} do test "shows the latest purchase", %{conn: conn, collection: collection} do
latest_record = List.last(collection) latest_record = List.last(collection)
session = session =
@@ -65,13 +65,13 @@ defmodule MusicLibraryWeb.StatsLive.IndexTest do
end end
end end
test "it shows the wishlist total count", %{conn: conn, wishlist: wishlist} do test "shows the wishlist total count", %{conn: conn, wishlist: wishlist} do
conn conn
|> visit("/") |> visit("/")
|> assert_has("dd", wishlist |> length() |> Integer.to_string()) |> assert_has("dd", wishlist |> length() |> Integer.to_string())
end end
test "it displays records for the current date in the 'On This Day' section", %{ test "displays records for the current date in the 'On This Day' section", %{
conn: conn, conn: conn,
collection: collection collection: collection
} do } do
@@ -103,7 +103,7 @@ defmodule MusicLibraryWeb.StatsLive.IndexTest do
refute_has(session, "##{record_yesterday.id} h2", escape(record_yesterday.title)) refute_has(session, "##{record_yesterday.id} h2", escape(record_yesterday.title))
end end
test "it updates the 'On This Day' records when the date is changed", %{ test "updates the 'On This Day' records when the date is changed", %{
conn: conn, conn: conn,
collection: collection collection: collection
} do } do
@@ -146,7 +146,7 @@ defmodule MusicLibraryWeb.StatsLive.IndexTest do
end end
describe "Scrobble activity" do describe "Scrobble activity" do
test "it shows the scrobble activity", %{conn: conn} do test "shows the scrobble activity", %{conn: conn} do
# In test we don't run the LastFm.Refresh worker, # In test we don't run the LastFm.Refresh worker,
# so we need to interact directly with the LastFm.Feed to have some data # so we need to interact directly with the LastFm.Feed to have some data
# #
@@ -20,7 +20,7 @@ defmodule MusicLibraryWeb.WishlistLive.ShowTest do
end end
describe "Show record" do describe "Show record" do
test "it includes all needed information", %{conn: conn} do test "includes all needed information", %{conn: conn} do
record = record(purchased_at: nil) record = record(purchased_at: nil)
transform = %Transform{hash: record.cover_hash, width: nil} transform = %Transform{hash: record.cover_hash, width: nil}
payload = Transform.encode!(transform) payload = Transform.encode!(transform)