Remote Timeline: add Streaming support
[akkoma] / test / web / pleroma_api / views / chat_view_test.exs
index 6062a0cfef122d2e469d510141d63228c8ae0d2e..02484b705b7ccd380fd60d41d1eb5b5ea2602ba1 100644 (file)
@@ -6,11 +6,12 @@ defmodule Pleroma.Web.PleromaAPI.ChatViewTest do
   use Pleroma.DataCase
 
   alias Pleroma.Chat
+  alias Pleroma.Chat.MessageReference
   alias Pleroma.Object
   alias Pleroma.Web.CommonAPI
   alias Pleroma.Web.CommonAPI.Utils
   alias Pleroma.Web.MastodonAPI.AccountView
-  alias Pleroma.Web.PleromaAPI.ChatMessageView
+  alias Pleroma.Web.PleromaAPI.Chat.MessageReferenceView
   alias Pleroma.Web.PleromaAPI.ChatView
 
   import Pleroma.Factory
@@ -25,7 +26,8 @@ defmodule Pleroma.Web.PleromaAPI.ChatViewTest do
 
     assert represented_chat == %{
              id: "#{chat.id}",
-             account: AccountView.render("show.json", user: recipient),
+             account:
+               AccountView.render("show.json", user: recipient, skip_visibility_check: true),
              unread: 0,
              last_message: nil,
              updated_at: Utils.to_masto_date(chat.updated_at)
@@ -39,7 +41,9 @@ defmodule Pleroma.Web.PleromaAPI.ChatViewTest do
 
     represented_chat = ChatView.render("show.json", chat: chat)
 
+    cm_ref = MessageReference.for_chat_and_object(chat, chat_message)
+
     assert represented_chat[:last_message] ==
-             ChatMessageView.render("show.json", chat: chat, object: chat_message)
+             MessageReferenceView.render("show.json", chat_message_reference: cm_ref)
   end
 end