summaryrefslogtreecommitdiff
path: root/test/pleroma/conversation/participation_test.exs
diff options
context:
space:
mode:
Diffstat (limited to 'test/pleroma/conversation/participation_test.exs')
-rw-r--r--test/pleroma/conversation/participation_test.exs25
1 files changed, 18 insertions, 7 deletions
diff --git a/test/pleroma/conversation/participation_test.exs b/test/pleroma/conversation/participation_test.exs
index 5a603dcc1..a25e17c95 100644
--- a/test/pleroma/conversation/participation_test.exs
+++ b/test/pleroma/conversation/participation_test.exs
@@ -1,9 +1,9 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Conversation.ParticipationTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
alias Pleroma.Conversation
alias Pleroma.Conversation.Participation
@@ -96,12 +96,11 @@ defmodule Pleroma.Conversation.ParticipationTest do
{:ok, %Participation{} = participation} =
Participation.create_for_user_and_conversation(user, conversation)
+ {:ok, participation} = time_travel(participation, -2)
+
assert participation.user_id == user.id
assert participation.conversation_id == conversation.id
- # Needed because updated_at is accurate down to a second
- :timer.sleep(1000)
-
# Creating again returns the same participation
{:ok, %Participation{} = participation_two} =
Participation.create_for_user_and_conversation(user, conversation)
@@ -176,8 +175,8 @@ defmodule Pleroma.Conversation.ParticipationTest do
assert [participation_one, participation_two] = Participation.for_user(user)
- object2 = Pleroma.Object.normalize(activity_two)
- object3 = Pleroma.Object.normalize(activity_three)
+ object2 = Pleroma.Object.normalize(activity_two, fetch: false)
+ object3 = Pleroma.Object.normalize(activity_three, fetch: false)
user = Repo.get(Pleroma.User, user.id)
@@ -360,4 +359,16 @@ defmodule Pleroma.Conversation.ParticipationTest do
assert Participation.unread_count(blocked) == 1
end
end
+
+ test "deletes a conversation" do
+ user = insert(:user)
+ other_user = insert(:user)
+
+ {:ok, _activity} =
+ CommonAPI.post(user, %{status: "Hey @#{other_user.nickname}.", visibility: "direct"})
+
+ assert [participation] = Participation.for_user(other_user)
+ assert {:ok, _} = Participation.delete(participation)
+ assert [] == Participation.for_user(other_user)
+ end
end