diff options
author | feld <feld@feld.me> | 2024-05-08 17:55:32 +0000 |
---|---|---|
committer | feld <feld@feld.me> | 2024-05-08 17:55:32 +0000 |
commit | 6cfb0d7ddbfca5aef79b6da04e1abb1b1a4b59b7 (patch) | |
tree | 4316769df669c5e1e95e01bac3d48c747d36423d /test | |
parent | 8eea4f58c7ae1618aec9f0c6a62e16771c34b787 (diff) | |
parent | ccceb41bf3f50ce914c16c2a18ec882e97309214 (diff) | |
download | pleroma-6cfb0d7ddbfca5aef79b6da04e1abb1b1a4b59b7.tar.gz pleroma-6cfb0d7ddbfca5aef79b6da04e1abb1b1a4b59b7.zip |
Merge branch 'restore/card-img-alt' into 'develop'
Include image description in status media cards
See merge request pleroma/pleroma!4108
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/web/mastodon_api/views/status_view_test.exs | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/test/pleroma/web/mastodon_api/views/status_view_test.exs b/test/pleroma/web/mastodon_api/views/status_view_test.exs index 663610442..1c2d7f7fd 100644 --- a/test/pleroma/web/mastodon_api/views/status_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/status_view_test.exs @@ -738,7 +738,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do {:ok, card} = Card.create(page_url, %{image: page_url <> "/example.jpg", title: "Example website"}) - %{provider_name: "example.com"} = StatusView.render("card.json", card) + assert match?(%{provider_name: "example.com"}, StatusView.render("card.json", card)) end test "a rich media card without a site name or image renders correctly" do @@ -751,7 +751,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do {:ok, card} = Card.create(page_url, fields) - %{provider_name: "example.com"} = StatusView.render("card.json", card) + assert match?(%{provider_name: "example.com"}, StatusView.render("card.json", card)) end test "a rich media card without an image renders correctly" do @@ -765,7 +765,24 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do {:ok, card} = Card.create(page_url, fields) - %{provider_name: "example.com"} = StatusView.render("card.json", card) + assert match?(%{provider_name: "example.com"}, StatusView.render("card.json", card)) + end + + test "a rich media card without descriptions returns the fields with empty strings" do + page_url = "https://example.com" + + fields = %{ + "url" => page_url, + "site_name" => "Example site name", + "title" => "Example website" + } + + {:ok, card} = Card.create(page_url, fields) + + assert match?( + %{description: "", image_description: ""}, + StatusView.render("card.json", card) + ) end test "a rich media card with all relevant data renders correctly" do @@ -781,7 +798,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do {:ok, card} = Card.create(page_url, fields) - %{provider_name: "example.com"} = StatusView.render("card.json", card) + assert match?(%{provider_name: "example.com"}, StatusView.render("card.json", card)) end test "a rich media card has all media proxied" do |