diff options
author | Mark Felder <feld@feld.me> | 2024-05-08 13:54:57 -0400 |
---|---|---|
committer | Mark Felder <feld@feld.me> | 2024-05-08 13:54:57 -0400 |
commit | ccceb41bf3f50ce914c16c2a18ec882e97309214 (patch) | |
tree | 4316769df669c5e1e95e01bac3d48c747d36423d /test | |
parent | 5e7f4f687e55813059176d6046ac32c35e0e0738 (diff) | |
download | pleroma-ccceb41bf3f50ce914c16c2a18ec882e97309214.tar.gz pleroma-ccceb41bf3f50ce914c16c2a18ec882e97309214.zip |
Add test for StatusView rendering of Cards when missing descriptions
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/web/mastodon_api/views/status_view_test.exs | 17 |
1 files changed, 17 insertions, 0 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 c1313eb1b..1c2d7f7fd 100644 --- a/test/pleroma/web/mastodon_api/views/status_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/status_view_test.exs @@ -768,6 +768,23 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do 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 page_url = "https://example.com" |