Fix doubly-wrapped safe tuple in artist bio render
This commit is contained in:
@@ -739,6 +739,6 @@ defmodule MusicLibraryWeb.ArtistLive.Show do
|
||||
# Wikipedia returns sanitized HTML, so we can skip sanitization.
|
||||
# sobelow_skip ["XSS.Raw"]
|
||||
defp render_bio(biography) do
|
||||
{Phoenix.HTML.raw(biography.bio_html)}
|
||||
Phoenix.HTML.raw(biography.bio_html)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -47,6 +47,33 @@ defmodule MusicLibraryWeb.ArtistLive.ShowTest do
|
||||
|> assert_has("dt", "Biography")
|
||||
end
|
||||
|
||||
test "renders the Wikipedia biography in the bio sheet", %{
|
||||
conn: conn,
|
||||
artist_musicbrainz_id: artist_musicbrainz_id,
|
||||
artist_info: artist_info
|
||||
} do
|
||||
artist_info
|
||||
|> Ecto.Changeset.change(wikipedia_data: Wikipedia.Fixtures.article_summary())
|
||||
|> MusicLibrary.Repo.update!()
|
||||
|
||||
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("dt", "Biography")
|
||||
|> assert_has("span", "Wikipedia")
|
||||
|> assert_has("p", text: "English musician")
|
||||
end
|
||||
|
||||
test "gracefully handles errors in fetching bio and play count", %{
|
||||
conn: conn,
|
||||
artist_musicbrainz_id: artist_musicbrainz_id
|
||||
|
||||
Reference in New Issue
Block a user