test: fix unit backend tests
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -5,7 +5,7 @@ defmodule Mobilizon.Service.Activity.ConversationTest do
|
||||
|
||||
alias Mobilizon.Actors.Actor
|
||||
alias Mobilizon.Conversations
|
||||
alias Mobilizon.Conversations.Conversation
|
||||
alias Mobilizon.Conversations.{Conversation, ConversationParticipant}
|
||||
alias Mobilizon.Discussions.Comment
|
||||
alias Mobilizon.Service.Activity.Conversation, as: ConversationActivity
|
||||
alias Mobilizon.Service.Workers.LegacyNotifierBuilder
|
||||
@@ -20,11 +20,19 @@ defmodule Mobilizon.Service.Activity.ConversationTest do
|
||||
%User{} = user = insert(:user)
|
||||
%Actor{id: actor_id} = actor = insert(:actor, user: user)
|
||||
|
||||
%Conversation{id: conversation_id, last_comment: %Comment{actor_id: last_comment_actor_id}} =
|
||||
conversation = insert(:conversation)
|
||||
%Conversation{
|
||||
id: conversation_id,
|
||||
last_comment: %Comment{actor_id: last_comment_actor_id}
|
||||
} =
|
||||
conversation = insert(:conversation, event: nil)
|
||||
|
||||
insert(:conversation_participant, actor: actor, conversation: conversation)
|
||||
insert(:conversation_participant, conversation: conversation)
|
||||
%ConversationParticipant{id: conversation_participant_actor_id} =
|
||||
insert(:conversation_participant, actor: actor, conversation: conversation)
|
||||
|
||||
%ConversationParticipant{
|
||||
id: conversation_participant_id,
|
||||
actor: %Actor{id: conversation_other_participant_actor_id}
|
||||
} = insert(:conversation_participant, conversation: conversation)
|
||||
|
||||
conversation = Conversations.get_conversation(conversation_id)
|
||||
|
||||
@@ -35,13 +43,14 @@ defmodule Mobilizon.Service.Activity.ConversationTest do
|
||||
worker: LegacyNotifierBuilder,
|
||||
args: %{
|
||||
"author_id" => last_comment_actor_id,
|
||||
"participants" => [actor_id],
|
||||
"participant" => %{"actor_id" => actor_id, "id" => conversation_participant_actor_id},
|
||||
"object_id" => to_string(conversation_id),
|
||||
"object_type" => "conversation",
|
||||
"op" => "legacy_notify",
|
||||
"subject" => "conversation_created",
|
||||
"subject_params" => %{
|
||||
"conversation_id" => conversation_id
|
||||
"conversation_id" => conversation_id,
|
||||
"conversation_participant_id" => conversation_participant_actor_id
|
||||
},
|
||||
"type" => "conversation"
|
||||
}
|
||||
@@ -50,19 +59,20 @@ defmodule Mobilizon.Service.Activity.ConversationTest do
|
||||
assert_enqueued(
|
||||
worker: LegacyNotifierBuilder,
|
||||
args: %{
|
||||
"author_id" => author_id,
|
||||
"object_id" => to_string(comment_id),
|
||||
"object_type" => "comment",
|
||||
"op" => "legacy_notify",
|
||||
"subject" => "event_new_comment",
|
||||
"subject_params" => %{
|
||||
"comment_reply_to_uuid" => nil,
|
||||
"event_title" => event_title,
|
||||
"event_uuid" => event_uuid,
|
||||
"comment_reply_to" => false,
|
||||
"comment_uuid" => comment_uuid
|
||||
"author_id" => last_comment_actor_id,
|
||||
"participant" => %{
|
||||
"actor_id" => conversation_other_participant_actor_id,
|
||||
"id" => conversation_participant_id
|
||||
},
|
||||
"type" => "comment"
|
||||
"object_id" => to_string(conversation_id),
|
||||
"object_type" => "conversation",
|
||||
"op" => "legacy_notify",
|
||||
"subject" => "conversation_created",
|
||||
"subject_params" => %{
|
||||
"conversation_id" => conversation_id,
|
||||
"conversation_participant_id" => conversation_participant_id
|
||||
},
|
||||
"type" => "conversation"
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user