1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.User.WelcomeChatMessageTest do
8 alias Pleroma.User.WelcomeChatMessage
10 import Pleroma.Factory
12 setup do: clear_config([:welcome])
14 describe "post_message/1" do
15 test "send a chat welcome message" do
16 welcome_user = insert(:user, name: "mewmew")
19 clear_config([:welcome, :chat_message, :enabled], true)
20 clear_config([:welcome, :chat_message, :sender_nickname], welcome_user.nickname)
23 [:welcome, :chat_message, :message],
24 "Hello, welcome to Blob/Cat!"
27 {:ok, %Pleroma.Activity{} = activity} = WelcomeChatMessage.post_message(user)
29 assert user.ap_id in activity.recipients
30 assert Pleroma.Object.normalize(activity, fetch: false).data["type"] == "ChatMessage"
32 assert Pleroma.Object.normalize(activity, fetch: false).data["content"] ==
33 "Hello, welcome to Blob/Cat!"