Improved WelcomeChatMessageTest
* Checks if message is the same using ==/2 instead of =~/2
This commit is contained in:
parent
13e5540c2c
commit
cbf8bfc694
1 changed files with 4 additions and 4 deletions
|
@ -14,22 +14,22 @@ defmodule Pleroma.User.WelcomeChatMessageTest do
|
||||||
|
|
||||||
describe "post_message/1" do
|
describe "post_message/1" do
|
||||||
test "send a chat welcome message" do
|
test "send a chat welcome message" do
|
||||||
welcome_user = insert(:user)
|
welcome_user = insert(:user, name: "mewmew")
|
||||||
user = insert(:user, name: "mewmew")
|
user = insert(:user)
|
||||||
|
|
||||||
Config.put([:welcome, :chat_message, :enabled], true)
|
Config.put([:welcome, :chat_message, :enabled], true)
|
||||||
Config.put([:welcome, :chat_message, :sender_nickname], welcome_user.nickname)
|
Config.put([:welcome, :chat_message, :sender_nickname], welcome_user.nickname)
|
||||||
|
|
||||||
Config.put(
|
Config.put(
|
||||||
[:welcome, :chat_message, :message],
|
[:welcome, :chat_message, :message],
|
||||||
"Hello. Welcome to blob.cat"
|
"Hello, welcome to Blob/Cat!"
|
||||||
)
|
)
|
||||||
|
|
||||||
{:ok, %Pleroma.Activity{} = activity} = WelcomeChatMessage.post_message(user)
|
{:ok, %Pleroma.Activity{} = activity} = WelcomeChatMessage.post_message(user)
|
||||||
|
|
||||||
assert user.ap_id in activity.recipients
|
assert user.ap_id in activity.recipients
|
||||||
assert Pleroma.Object.normalize(activity).data["type"] == "ChatMessage"
|
assert Pleroma.Object.normalize(activity).data["type"] == "ChatMessage"
|
||||||
assert Pleroma.Object.normalize(activity).data["content"] =~ "Hello. Welcome to "
|
assert Pleroma.Object.normalize(activity).data["content"] == "Hello, welcome to Blob/Cat!"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue