aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscarlett <nia@netbsd.org>2019-01-05 21:46:42 +0000
committerscarlett <nia@netbsd.org>2019-01-05 21:46:42 +0000
commit57df7d6e1da1a94a3866afc9b6d353aea602d4d3 (patch)
tree96b902954d1422bea32fc5099ed447fcb4c3e54c
parent096e121879f5e9aad694f1b57438f0545ecd73b3 (diff)
downloadpleroma-57df7d6e1da1a94a3866afc9b6d353aea602d4d3.tar.gz
Add tests for emoji and lack of HTML in summaries.
-rw-r--r--test/web/twitter_api/views/activity_view_test.exs29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/web/twitter_api/views/activity_view_test.exs b/test/web/twitter_api/views/activity_view_test.exs
index 32a08dbc9..05780a54a 100644
--- a/test/web/twitter_api/views/activity_view_test.exs
+++ b/test/web/twitter_api/views/activity_view_test.exs
@@ -41,6 +41,35 @@ defmodule Pleroma.Web.TwitterAPI.ActivityViewTest do
"#Bike log - Commute Tuesday\nhttps://pla.bike/posts/20181211/\n#cycling #CHScycling #commute\nMVIMG_20181211_054020.jpg"
end
+ test "a create activity with a summary containing emoji" do
+ {:ok, activity} =
+ CommonAPI.post(insert(:user), %{
+ "spoiler_text" => ":woollysocks: meow",
+ "status" => "."
+ })
+
+ result = ActivityView.render("activity.json", activity: activity)
+
+ expected =
+ "<img height=\"32px\" width=\"32px\" alt=\"woollysocks\" title=\"woollysocks\" src=\"http://localhost:4001/finmoji/128px/woollysocks-128.png\" /> meow"
+
+ assert result["summary"] == expected
+ end
+
+ test "a create activity with a summary containing invalid HTML" do
+ {:ok, activity} =
+ CommonAPI.post(insert(:user), %{
+ "spoiler_text" => "<span style=\"color: magenta; font-size: 32px;\">meow</span>",
+ "status" => "."
+ })
+
+ result = ActivityView.render("activity.json", activity: activity)
+
+ expected = "meow"
+
+ assert result["summary"] == expected
+ end
+
test "a create activity with a note" do
user = insert(:user)
other_user = insert(:user, %{nickname: "shp"})