Support choosing a selected release

This commit is contained in:
Claudio Ortolina
2025-05-01 17:42:40 +01:00
parent cba06ec5dc
commit 3e7341d4ca
14 changed files with 137 additions and 4 deletions
@@ -2,7 +2,10 @@ defmodule MusicLibraryWeb.CollectionLive.ShowTest do
use MusicLibraryWeb.ConnCase
import MusicLibrary.Fixtures.Records
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
import MusicLibraryWeb.RecordComponents,
only: [format_label: 1, type_label: 1, selected_release_label: 1]
alias MusicLibrary.Records.Record
describe "Edit record from show page" do
@@ -32,6 +35,7 @@ defmodule MusicLibraryWeb.CollectionLive.ShowTest do
|> assert_has("dd", text: Record.format_as_date(record.purchased_at))
|> assert_has("dd", text: record.id)
|> assert_has("a", text: record.musicbrainz_id)
|> assert_has("dd", text: selected_release_label(record))
|> assert_has("dd", text: Record.format_as_date(record.inserted_at))
|> assert_has("dd", text: Record.format_as_date(record.updated_at))
|> assert_has("img[src='#{cover_url}']")
@@ -2,7 +2,10 @@ defmodule MusicLibraryWeb.WishlistLive.ShowTest do
use MusicLibraryWeb.ConnCase
import MusicLibrary.Fixtures.Records
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
import MusicLibraryWeb.RecordComponents,
only: [format_label: 1, type_label: 1, selected_release_label: 1]
alias MusicLibrary.Records.Record
describe "Edit record from show page" do
@@ -31,6 +34,7 @@ defmodule MusicLibraryWeb.WishlistLive.ShowTest do
|> assert_has("p", text: type_label(record.type))
|> assert_has("dd", text: record.id)
|> assert_has("a", text: record.musicbrainz_id)
|> assert_has("dd", text: selected_release_label(record))
|> assert_has("dd", text: Record.format_as_date(record.inserted_at))
|> assert_has("dd", text: Record.format_as_date(record.updated_at))
|> assert_has("img[src='#{cover_url}']")
@@ -66,6 +66,7 @@ defmodule MusicLibrary.Fixtures.Records do
title: Enum.random(@titles),
type: :album,
format: Record.formats() |> Enum.random(),
selected_release_id: "d3f9b9e2-73f5-4b47-a2a7-2c2199aad608",
release_date: Enum.random(1969..2024) |> Integer.to_string(),
purchased_at: current_time,
artists: [artist_attrs(artist_name)]