Rename record_fixture* to record*
This commit is contained in:
@@ -6,7 +6,7 @@ defmodule MusicLibrary.ArtistsTest do
|
||||
|
||||
describe "get_artist/1" do
|
||||
test "it returns records with essential data" do
|
||||
record = record_fixture()
|
||||
record = record()
|
||||
[expected] = record.artists
|
||||
|
||||
artist = Artists.get_artist!(expected.musicbrainz_id)
|
||||
|
||||
@@ -7,24 +7,24 @@ defmodule MusicLibrary.CollectionTest do
|
||||
defp fill_collection(_) do
|
||||
# Purchased dates are in ascending order
|
||||
records = [
|
||||
record_fixture_with_artist("Marillion", %{
|
||||
record_with_artist("Marillion", %{
|
||||
title: "Brave",
|
||||
format: :cd,
|
||||
type: :album,
|
||||
purchased_at: ~U[2024-12-27 16:50:57Z]
|
||||
}),
|
||||
record_fixture_with_artist("Marillion", %{
|
||||
record_with_artist("Marillion", %{
|
||||
title: "Brave (Remastered)",
|
||||
format: :vinyl,
|
||||
type: :live,
|
||||
purchased_at: ~U[2024-12-28 16:50:57Z]
|
||||
}),
|
||||
record_fixture_with_artist("Marillion", %{
|
||||
record_with_artist("Marillion", %{
|
||||
format: :vinyl,
|
||||
type: :ep,
|
||||
purchased_at: ~U[2024-12-29 16:50:57Z]
|
||||
}),
|
||||
record_fixture_with_artist("Marillion", %{
|
||||
record_with_artist("Marillion", %{
|
||||
title: "Brave",
|
||||
format: :dvd,
|
||||
purchased_at: nil,
|
||||
@@ -90,7 +90,7 @@ defmodule MusicLibrary.CollectionTest do
|
||||
setup [:fill_collection]
|
||||
|
||||
test "returns the most recently purchased record" do
|
||||
expected_record = record_fixture(%{purchased_at: DateTime.utc_now()})
|
||||
expected_record = record(%{purchased_at: DateTime.utc_now()})
|
||||
most_recent_purchase = Collection.get_latest_record!()
|
||||
|
||||
assert expected_record.id == most_recent_purchase.id
|
||||
|
||||
@@ -12,11 +12,11 @@ defmodule MusicLibrary.RecordsTest do
|
||||
|
||||
defp create_records(_) do
|
||||
records = [
|
||||
record_fixture_with_artist("Marillion", %{title: "Brave", format: :vinyl}),
|
||||
record_fixture_with_artist("Marillion", %{title: "Brave (Live)", format: :cd, type: :live}),
|
||||
record_fixture_with_artist("Marillion", %{title: "Afraid of Sunlight"}),
|
||||
record_fixture_with_artist("Airbag", %{title: "The Greatest Show on Earth"}),
|
||||
record_fixture_with_artist("Airbag (AU)", %{title: "Libertad"})
|
||||
record_with_artist("Marillion", %{title: "Brave", format: :vinyl}),
|
||||
record_with_artist("Marillion", %{title: "Brave (Live)", format: :cd, type: :live}),
|
||||
record_with_artist("Marillion", %{title: "Afraid of Sunlight"}),
|
||||
record_with_artist("Airbag", %{title: "The Greatest Show on Earth"}),
|
||||
record_with_artist("Airbag (AU)", %{title: "Libertad"})
|
||||
]
|
||||
|
||||
%{records: records}
|
||||
@@ -33,7 +33,7 @@ defmodule MusicLibrary.RecordsTest do
|
||||
describe "create_record/1" do
|
||||
test "populates computed values" do
|
||||
record =
|
||||
record_fixture(musicbrainz_data: release_group(:lockdown_trilogy))
|
||||
record(musicbrainz_data: release_group(:lockdown_trilogy))
|
||||
|
||||
assert record.release_ids == ["77e746fc-566f-445b-a62b-cc014280fac9"]
|
||||
|
||||
@@ -54,7 +54,7 @@ defmodule MusicLibrary.RecordsTest do
|
||||
release_group_id = release_group_id(:marbles)
|
||||
|
||||
record =
|
||||
record_fixture(
|
||||
record(
|
||||
musicbrainz_id: release_group_id,
|
||||
musicbrainz_data: Map.put(release_group(:marbles), "releases", [])
|
||||
)
|
||||
@@ -149,7 +149,7 @@ defmodule MusicLibrary.RecordsTest do
|
||||
test "it fetches the record by id" do
|
||||
# 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.
|
||||
expected = record_fixture()
|
||||
expected = record()
|
||||
|
||||
assert expected == Records.get_record!(expected.id)
|
||||
end
|
||||
@@ -157,7 +157,7 @@ defmodule MusicLibrary.RecordsTest do
|
||||
|
||||
describe "get_artists_records/1" do
|
||||
test "it returns records with essential data" do
|
||||
expected = record_fixture()
|
||||
expected = record()
|
||||
|
||||
artist_musicbrainz_id = expected.artists |> hd() |> Map.get(:musicbrainz_id)
|
||||
|
||||
@@ -171,7 +171,7 @@ defmodule MusicLibrary.RecordsTest do
|
||||
test "it returns the record cover by id" do
|
||||
# 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.
|
||||
expected = record_fixture()
|
||||
expected = record()
|
||||
|
||||
assert Map.take(expected, [:cover_hash, :cover_data]) == Records.get_cover(expected.id)
|
||||
end
|
||||
@@ -293,7 +293,7 @@ defmodule MusicLibrary.RecordsTest do
|
||||
|
||||
describe "refresh cover/1" do
|
||||
test "it fetches and stores the updated cover" do
|
||||
record = record_fixture(cover_data: File.read!(marbles_cover_fixture()))
|
||||
record = record(cover_data: File.read!(marbles_cover_fixture()))
|
||||
|
||||
raven_cover_data = File.read!(raven_cover_fixture())
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ defmodule MusicLibrary.WishlistTest do
|
||||
|
||||
defp fill_wishlist(_) do
|
||||
records = [
|
||||
record_fixture(%{purchased_at: nil, title: "Brave"}),
|
||||
record_fixture(%{purchased_at: nil, title: "Brave"}),
|
||||
record_fixture(%{purchased_at: nil}),
|
||||
record_fixture(%{title: "Brave"})
|
||||
record(%{purchased_at: nil, title: "Brave"}),
|
||||
record(%{purchased_at: nil, title: "Brave"}),
|
||||
record(%{purchased_at: nil}),
|
||||
record(%{title: "Brave"})
|
||||
]
|
||||
|
||||
%{wishlist: records}
|
||||
|
||||
Reference in New Issue
Block a user