summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/pleroma/web/push/impl_test.exs21
-rw-r--r--test/support/factory.ex1
2 files changed, 22 insertions, 0 deletions
diff --git a/test/pleroma/web/push/impl_test.exs b/test/pleroma/web/push/impl_test.exs
index 3ceea3d71..e1bbf8d17 100644
--- a/test/pleroma/web/push/impl_test.exs
+++ b/test/pleroma/web/push/impl_test.exs
@@ -232,6 +232,27 @@ defmodule Pleroma.Web.Push.ImplTest do
"New Direct Message"
end
+ test "renders poll notification" do
+ user = insert(:user)
+ question = insert(:question, user: user)
+ activity = insert(:question_activity, question: question)
+
+ {:ok, [notification]} = Notification.create_poll_notifications(activity)
+
+ assert Impl.format_title(notification) == "Poll Results"
+
+ expected_body =
+ """
+ Which flavor of ice cream do you prefer?
+
+ ○ chocolate
+ ○ vanilla
+ """
+ |> String.trim_trailing("\n")
+
+ assert Impl.format_body(notification, user, question) == expected_body
+ end
+
describe "build_content/3" do
test "builds content for chat messages" do
user = insert(:user)
diff --git a/test/support/factory.ex b/test/support/factory.ex
index 20bc5162e..b248508fa 100644
--- a/test/support/factory.ex
+++ b/test/support/factory.ex
@@ -249,6 +249,7 @@ defmodule Pleroma.Factory do
"cc" => [user.follower_address],
"context" => Pleroma.Web.ActivityPub.Utils.generate_context_id(),
"closed" => DateTime.utc_now() |> DateTime.add(86_400) |> DateTime.to_iso8601(),
+ "content" => "Which flavor of ice cream do you prefer?",
"oneOf" => [
%{
"type" => "Note",