1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.PleromaAPI.ChatViewTest do
9 alias Pleroma.Web.PleromaAPI.ChatView
10 alias Pleroma.Web.MastodonAPI.AccountView
12 import Pleroma.Factory
14 test "it represents a chat" do
16 recipient = insert(:user)
18 {:ok, chat} = Chat.get_or_create(user.id, recipient.ap_id)
20 represented_chat = ChatView.render("show.json", chat: chat)
22 assert represented_chat == %{
24 recipient: recipient.ap_id,
25 recipient_account: AccountView.render("show.json", user: recipient),