Fix test descriptions for consistency

This commit is contained in:
Claudio Ortolina
2026-03-26 11:54:47 +00:00
parent 69983d9dac
commit 170a52b3e4
8 changed files with 19 additions and 19 deletions
+1 -1
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 seconds" do test "it 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()
+1 -1
View File
@@ -82,7 +82,7 @@ defmodule MusicLibrary.ArtistsTest do
end end
end end
describe "fetch_artist_info/1" do describe "refresh_artist_info/1" do
test "it stores musicbrainz and discogs data" do test "it stores musicbrainz and discogs data" do
steven_wilson_musicbrainz_id = "3a51b862-0144-40f6-aa17-6aaeefea29d9" steven_wilson_musicbrainz_id = "3a51b862-0144-40f6-aa17-6aaeefea29d9"
+3 -3
View File
@@ -44,17 +44,17 @@ defmodule MusicLibrary.CollectionTest do
Collection.search_records("brave") Collection.search_records("brave")
end end
test "it respects limit" do test "respects limit" do
assert [%{title: "Brave"}] = Collection.search_records("brave", limit: 1) assert [%{title: "Brave"}] = Collection.search_records("brave", limit: 1)
end end
test "it respects offset" do test "respects offset" do
[first_match] = Collection.search_records("brave", limit: 1) [first_match] = Collection.search_records("brave", limit: 1)
[second_match] = Collection.search_records("brave", limit: 1, offset: 1) [second_match] = Collection.search_records("brave", limit: 1, offset: 1)
assert first_match !== second_match assert first_match !== second_match
end end
test "it respects order" do test "respects order" do
assert [%{title: "Brave (Remastered)"}, %{title: "Brave"}] = assert [%{title: "Brave (Remastered)"}, %{title: "Brave"}] =
Collection.search_records("brave", order: :purchase) Collection.search_records("brave", order: :purchase)
+1 -1
View File
@@ -229,7 +229,7 @@ defmodule MusicLibrary.ListeningStatsTest do
end end
end end
test "returns error when track has already been deleted" do test "raises when track has already been deleted" do
track = track_fixture() track = track_fixture()
{:ok, _} = ListeningStats.delete_track(track) {:ok, _} = ListeningStats.delete_track(track)
+1 -1
View File
@@ -33,7 +33,7 @@ defmodule MusicLibrary.Records.RecordTest do
assert Record.released?(record, current_date) assert Record.released?(record, current_date)
end end
test "it returns true if the release date is not precise enough", %{ test "returns true if the release date is not precise enough", %{
current_date: current_date current_date: current_date
} do } do
record = %Record{release_date: "2019"} record = %Record{release_date: "2019"}
+9 -9
View File
@@ -51,7 +51,7 @@ defmodule MusicLibrary.RecordsTest do
assert Enum.all?(record.dominant_colors, &color_hex?/1) assert Enum.all?(record.dominant_colors, &color_hex?/1)
end end
test "it queues a task to retrieve artist info data" do test "queues a task to retrieve artist info data" do
record = record =
record(musicbrainz_data: release_group(:lockdown_trilogy)) record(musicbrainz_data: release_group(:lockdown_trilogy))
@@ -63,7 +63,7 @@ defmodule MusicLibrary.RecordsTest do
end end
describe "delete_record/1" do describe "delete_record/1" do
test "it queues a task to delete artist info data" do test "queues a task to delete artist info data" do
record = record =
record(musicbrainz_data: release_group(:lockdown_trilogy)) record(musicbrainz_data: release_group(:lockdown_trilogy))
@@ -184,7 +184,7 @@ defmodule MusicLibrary.RecordsTest do
end end
describe "get_record!/1" do describe "get_record!/1" do
test "it fetches the record by id" do test "fetches the record by id" do
# while this test may seem redundant, it implicitely checks that ALL record fields are returned, # while this test may seem redundant, it implicitely checks that ALL record fields are returned,
# as opposed to other code paths where we only return essential ones. # as opposed to other code paths where we only return essential ones.
expected = record() expected = record()
@@ -193,8 +193,8 @@ defmodule MusicLibrary.RecordsTest do
end end
end end
describe "get_artists_records/1" do describe "get_artist_records/1" do
test "it returns records with essential data" do test "returns records with essential data" do
expected = record() expected = record()
artist_musicbrainz_id = expected.artists |> hd() |> Map.get(:musicbrainz_id) artist_musicbrainz_id = expected.artists |> hd() |> Map.get(:musicbrainz_id)
@@ -206,7 +206,7 @@ defmodule MusicLibrary.RecordsTest do
end end
describe "import_from_musicbrainz_release_group/2" do describe "import_from_musicbrainz_release_group/2" do
test "it saves a record with its cover art" do test "saves a record with its cover art" do
current_time = DateTime.utc_now() current_time = DateTime.utc_now()
release_group = release_group(:marbles) release_group = release_group(:marbles)
@@ -259,7 +259,7 @@ defmodule MusicLibrary.RecordsTest do
end end
describe "import_from_musicbrainz_release/2" do describe "import_from_musicbrainz_release/2" do
test "it saves a record with its cover art" do test "saves a record with its cover art" do
current_time = DateTime.utc_now() current_time = DateTime.utc_now()
release = release(:marbles) release = release(:marbles)
@@ -317,8 +317,8 @@ defmodule MusicLibrary.RecordsTest do
end end
end end
describe "refresh cover/1" do describe "refresh_cover/1" do
test "it fetches and stores the updated cover" do test "fetches and stores the updated cover" do
record = record(cover_data: marbles_cover_data()) record = record(cover_data: marbles_cover_data())
raven_cover_data = raven_cover_data() raven_cover_data = raven_cover_data()
@@ -111,7 +111,7 @@ defmodule MusicLibrary.ScrobbleRules.ScrobbleRuleTest do
assert "is invalid" in errors_on(changeset).target_musicbrainz_id assert "is invalid" in errors_on(changeset).target_musicbrainz_id
end end
test "valid changeset with uppercase UUID" do test "valid changeset with numeric UUID" do
attrs = %{ attrs = %{
type: :artist, type: :artist,
match_value: "Pink Floyd", match_value: "Pink Floyd",
@@ -23,7 +23,7 @@ defmodule MusicLibraryWeb.AssetControllerTest do
assert text_response(conn, 404) == "Not found" assert text_response(conn, 404) == "Not found"
end end
test "serves the asset without etag", %{conn: conn, asset: asset} do test "serves the asset when no etag is sent", %{conn: conn, asset: asset} do
transform = %Transform{hash: asset.hash} transform = %Transform{hash: asset.hash}
payload = Transform.encode!(transform) payload = Transform.encode!(transform)
conn = get(conn, ~p"/assets/#{payload}") conn = get(conn, ~p"/assets/#{payload}")
@@ -70,7 +70,7 @@ defmodule MusicLibraryWeb.AssetControllerTest do
assert conn.resp_body == <<>> assert conn.resp_body == <<>>
end end
test "it handles transforms with width", %{conn: conn, asset: asset} do test "handles transforms with width", %{conn: conn, asset: asset} do
transform = %Transform{hash: asset.hash, width: 480} transform = %Transform{hash: asset.hash, width: 480}
payload = Transform.encode!(transform) payload = Transform.encode!(transform)