Show country flag for artist

This commit is contained in:
Claudio Ortolina
2025-04-29 09:58:06 +01:00
parent 91a00fab94
commit f1dd45e438
10 changed files with 79 additions and 7 deletions
@@ -13,7 +13,13 @@ defmodule MusicLibraryWeb.ArtistLive.ShowTest do
[artist] = collection_record.artists
%{collection_record: collection_record, artist_musicbrainz_id: artist.musicbrainz_id}
artist_info = artist_info(artist.musicbrainz_id)
%{
collection_record: collection_record,
artist_musicbrainz_id: artist.musicbrainz_id,
artist_info: artist_info
}
end
describe "Show artist" do
@@ -64,6 +70,27 @@ defmodule MusicLibraryWeb.ArtistLive.ShowTest do
|> assert_has("div", text: "Error loading biography")
end
test "it shows the artist country", %{
conn: conn,
artist_musicbrainz_id: artist_musicbrainz_id
} do
Req.Test.stub(LastFm.API, fn conn ->
case Map.get(conn.params, "method") do
"artist.getInfo" ->
Req.Test.json(conn, Fixtures.Artist.get_info())
"artist.getSimilar" ->
Req.Test.json(conn, Fixtures.Artist.get_similar_artists())
end
end)
conn
|> visit(~p"/artists/#{artist_musicbrainz_id}")
|> unwrap(&render_async/1)
|> assert_has("span", text: "United Kingdom")
|> assert_has("span", text: "🇬🇧")
end
test "it shows records from the collection and the wishlist", %{
conn: conn,
collection_record: collection_record,