Add test for StatusView rendering of Cards when missing descriptions

This commit is contained in:
Mark Felder 2024-05-08 13:54:57 -04:00
parent 5e7f4f687e
commit ccceb41bf3
1 changed files with 17 additions and 0 deletions

View File

@ -768,6 +768,23 @@ test "a rich media card without an image renders correctly" do
assert match?(%{provider_name: "example.com"}, StatusView.render("card.json", card)) assert match?(%{provider_name: "example.com"}, StatusView.render("card.json", card))
end 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 test "a rich media card with all relevant data renders correctly" do
page_url = "https://example.com" page_url = "https://example.com"