aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMaksim Pechnikov <parallel588@gmail.com>2020-01-23 11:11:18 +0300
committerMaksim Pechnikov <parallel588@gmail.com>2020-01-23 11:11:18 +0300
commit5fc2fa89086e820352a9fec571f07f29a55c4f06 (patch)
tree7e4f4d2cce9182c9ecd70af9925a5a201a13b999 /test
parentce7c887a27ad5af59f540650637a50da7f91fa52 (diff)
parentdddebee047efc4ab1dff6565bef32954695846a7 (diff)
downloadpleroma-5fc2fa89086e820352a9fec571f07f29a55c4f06.tar.gz
Merge branch 'develop' into issue/1383
Diffstat (limited to 'test')
-rw-r--r--test/notification_test.exs12
-rw-r--r--test/web/mastodon_api/views/notification_view_test.exs27
2 files changed, 39 insertions, 0 deletions
diff --git a/test/notification_test.exs b/test/notification_test.exs
index 9a1c2f2b5..04bf5b41a 100644
--- a/test/notification_test.exs
+++ b/test/notification_test.exs
@@ -15,6 +15,18 @@ defmodule Pleroma.NotificationTest do
alias Pleroma.Web.Streamer
describe "create_notifications" do
+ test "creates a notification for an emoji reaction" do
+ user = insert(:user)
+ other_user = insert(:user)
+
+ {:ok, activity} = CommonAPI.post(user, %{"status" => "yeah"})
+ {:ok, activity, _object} = CommonAPI.react_with_emoji(activity.id, other_user, "☕")
+
+ {:ok, [notification]} = Notification.create_notifications(activity)
+
+ assert notification.user_id == user.id
+ end
+
test "notifies someone when they are directly addressed" do
user = insert(:user)
other_user = insert(:user)
diff --git a/test/web/mastodon_api/views/notification_view_test.exs b/test/web/mastodon_api/views/notification_view_test.exs
index ba1721e06..1fe83cb2c 100644
--- a/test/web/mastodon_api/views/notification_view_test.exs
+++ b/test/web/mastodon_api/views/notification_view_test.exs
@@ -134,4 +134,31 @@ defmodule Pleroma.Web.MastodonAPI.NotificationViewTest do
assert [expected] ==
NotificationView.render("index.json", %{notifications: [notification], for: follower})
end
+
+ test "EmojiReaction notification" do
+ user = insert(:user)
+ other_user = insert(:user)
+
+ {:ok, activity} = CommonAPI.post(user, %{"status" => "#cofe"})
+ {:ok, _activity, _} = CommonAPI.react_with_emoji(activity.id, other_user, "☕")
+
+ activity = Repo.get(Activity, activity.id)
+
+ [notification] = Notification.for_user(user)
+
+ assert notification
+
+ expected = %{
+ id: to_string(notification.id),
+ pleroma: %{is_seen: false},
+ type: "pleroma:emoji_reaction",
+ emoji: "☕",
+ account: AccountView.render("show.json", %{user: other_user, for: user}),
+ status: StatusView.render("show.json", %{activity: activity, for: user}),
+ created_at: Utils.to_masto_date(notification.inserted_at)
+ }
+
+ assert expected ==
+ NotificationView.render("show.json", %{notification: notification, for: user})
+ end
end