diff options
author | lain <lain@soykaf.club> | 2020-06-04 14:49:10 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-06-04 14:49:10 +0200 |
commit | b952f3f37907c735e3426ba43d01027f6f49c5b5 (patch) | |
tree | 85f0bc4bcc92dabbbe80d9ad6b1ec4ddb4d1bd5e /test/web | |
parent | 5d7dda883e76041025384e453da74110c550aa3b (diff) | |
download | pleroma-b952f3f37907c735e3426ba43d01027f6f49c5b5.tar.gz |
WebPush: Push out chat message notications.
Diffstat (limited to 'test/web')
-rw-r--r-- | test/web/push/impl_test.exs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/web/push/impl_test.exs b/test/web/push/impl_test.exs index 26c65bc82..8fb7faaa5 100644 --- a/test/web/push/impl_test.exs +++ b/test/web/push/impl_test.exs @@ -5,6 +5,7 @@ defmodule Pleroma.Web.Push.ImplTest do use Pleroma.DataCase + alias Pleroma.Notification alias Pleroma.Object alias Pleroma.User alias Pleroma.Web.CommonAPI @@ -196,6 +197,22 @@ defmodule Pleroma.Web.Push.ImplTest do end describe "build_content/3" do + test "builds content for chat messages" do + user = insert(:user) + recipient = insert(:user) + + {:ok, chat} = CommonAPI.post_chat_message(user, recipient, "hey") + object = Object.normalize(chat, false) + [notification] = Notification.for_user(recipient) + + res = Impl.build_content(notification, user, object) + + assert res == %{ + body: "@#{user.nickname}: hey", + title: "New Chat Message" + } + end + test "hides details for notifications when privacy option enabled" do user = insert(:user, nickname: "Bob") user2 = insert(:user, nickname: "Rob", notification_settings: %{privacy_option: true}) |