diff options
author | lain <lain@soykaf.club> | 2020-06-03 12:30:12 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-06-03 12:30:12 +0200 |
commit | aa22fce8f46cf2e7f871b3584fbfff7ac2ebe4c2 (patch) | |
tree | 861f95fdb3b8d01ad699db9ffc987678a3a41839 /test/web/activity_pub/side_effects_test.exs | |
parent | 2c6ebe709a9fb84bedb5d50c24715fd4532272f9 (diff) | |
download | pleroma-aa22fce8f46cf2e7f871b3584fbfff7ac2ebe4c2.tar.gz pleroma-aa22fce8f46cf2e7f871b3584fbfff7ac2ebe4c2.zip |
ChatMessageReference: Introduce and switch in chat controller.
Diffstat (limited to 'test/web/activity_pub/side_effects_test.exs')
-rw-r--r-- | test/web/activity_pub/side_effects_test.exs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/test/web/activity_pub/side_effects_test.exs b/test/web/activity_pub/side_effects_test.exs index 210ba6ef0..ff6b3ac15 100644 --- a/test/web/activity_pub/side_effects_test.exs +++ b/test/web/activity_pub/side_effects_test.exs @@ -8,6 +8,7 @@ defmodule Pleroma.Web.ActivityPub.SideEffectsTest do alias Pleroma.Activity alias Pleroma.Chat + alias Pleroma.ChatMessageReference alias Pleroma.Notification alias Pleroma.Object alias Pleroma.Repo @@ -330,7 +331,7 @@ defmodule Pleroma.Web.ActivityPub.SideEffectsTest do end end - test "it creates a Chat for the local users and bumps the unread count, except for the author" do + test "it creates a Chat and ChatMessageReferences for the local users and bumps the unread count, except for the author" do author = insert(:user, local: true) recipient = insert(:user, local: true) @@ -347,8 +348,18 @@ defmodule Pleroma.Web.ActivityPub.SideEffectsTest do chat = Chat.get(author.id, recipient.ap_id) assert chat.unread == 0 + [cm_ref] = ChatMessageReference.for_chat_query(chat) |> Repo.all() + + assert cm_ref.object.data["content"] == "hey" + assert cm_ref.seen == true + chat = Chat.get(recipient.id, author.ap_id) assert chat.unread == 1 + + [cm_ref] = ChatMessageReference.for_chat_query(chat) |> Repo.all() + + assert cm_ref.object.data["content"] == "hey" + assert cm_ref.seen == false end test "it creates a Chat for the local users and bumps the unread count" do |