summaryrefslogtreecommitdiff
path: root/test/web/pleroma_api/controllers/chat_controller_test.exs
diff options
context:
space:
mode:
Diffstat (limited to 'test/web/pleroma_api/controllers/chat_controller_test.exs')
-rw-r--r--test/web/pleroma_api/controllers/chat_controller_test.exs11
1 files changed, 7 insertions, 4 deletions
diff --git a/test/web/pleroma_api/controllers/chat_controller_test.exs b/test/web/pleroma_api/controllers/chat_controller_test.exs
index bd4024c09..e62b71799 100644
--- a/test/web/pleroma_api/controllers/chat_controller_test.exs
+++ b/test/web/pleroma_api/controllers/chat_controller_test.exs
@@ -19,9 +19,12 @@ defmodule Pleroma.Web.PleromaAPI.ChatControllerTest do
test "it marks all messages in a chat as read", %{conn: conn, user: user} do
other_user = insert(:user)
- {:ok, chat} = Chat.bump_or_create(user.id, other_user.ap_id)
+ {:ok, create} = CommonAPI.post_chat_message(other_user, user, "sup")
+ {:ok, chat} = Chat.get_or_create(user.id, other_user.ap_id)
+ object = Object.normalize(create, false)
+ cm_ref = ChatMessageReference.for_chat_and_object(chat, object)
- assert chat.unread == 1
+ assert cm_ref.seen == false
result =
conn
@@ -30,9 +33,9 @@ defmodule Pleroma.Web.PleromaAPI.ChatControllerTest do
assert result["unread"] == 0
- {:ok, chat} = Chat.get_or_create(user.id, other_user.ap_id)
+ cm_ref = ChatMessageReference.for_chat_and_object(chat, object)
- assert chat.unread == 0
+ assert cm_ref.seen == true
end
end