logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: ccceb41bf3f50ce914c16c2a18ec882e97309214
parent 5e7f4f687e55813059176d6046ac32c35e0e0738
Author: Mark Felder <feld@feld.me>
Date:   Wed,  8 May 2024 13:54:57 -0400

Add test for StatusView rendering of Cards when missing descriptions

Diffstat:

Mtest/pleroma/web/mastodon_api/views/status_view_test.exs17+++++++++++++++++
1 file 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 @@ -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"