summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/activity_test.exs14
-rw-r--r--test/web/activity_pub/transmogrifier_test.exs2
-rw-r--r--test/web/mastodon_api/mastodon_api_controller_test.exs4
-rw-r--r--test/web/twitter_api/twitter_api_test.exs2
4 files changed, 17 insertions, 5 deletions
diff --git a/test/activity_test.exs b/test/activity_test.exs
index ad889f544..d8063bf11 100644
--- a/test/activity_test.exs
+++ b/test/activity_test.exs
@@ -28,4 +28,18 @@ defmodule Pleroma.ActivityTest do
assert activity == found_activity
end
+
+ test "reply count" do
+ %{id: id, data: %{"object" => %{"id" => object_ap_id}}} = activity = insert(:note_activity)
+
+ repliesCount = activity.data["object"]["repliesCount"] || 0
+ expected_increase = repliesCount + 1
+ Activity.increase_replies_count(object_ap_id)
+ %{data: %{"object" => %{"repliesCount" => actual_increase}}} = Activity.get_by_id(id)
+ assert expected_increase == actual_increase
+ expected_decrease = expected_increase - 1
+ Activity.decrease_replies_count(object_ap_id)
+ %{data: %{"object" => %{"repliesCount" => actual_decrease}}} = Activity.get_by_id(id)
+ assert expected_decrease == actual_decrease
+ end
end
diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/web/activity_pub/transmogrifier_test.exs
index 47cffe257..c857a7ec1 100644
--- a/test/web/activity_pub/transmogrifier_test.exs
+++ b/test/web/activity_pub/transmogrifier_test.exs
@@ -58,8 +58,6 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
assert returned_activity.data["object"]["inReplyToAtomUri"] ==
"https://shitposter.club/notice/2827873"
-
- assert returned_activity.data["object"]["inReplyToStatusId"] == activity.id
end
test "it works for incoming notices" do
diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs
index 292cd46b8..df3315022 100644
--- a/test/web/mastodon_api/mastodon_api_controller_test.exs
+++ b/test/web/mastodon_api/mastodon_api_controller_test.exs
@@ -342,7 +342,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
activity = Activity.get_by_id(id)
assert activity.data["context"] == replied_to.data["context"]
- assert activity.data["object"]["inReplyToStatusId"] == replied_to.id
+ assert Activity.get_in_reply_to_activity(activity).id == replied_to.id
end
test "posting a status with an invalid in_reply_to_id", %{conn: conn} do
@@ -2724,7 +2724,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
activity = Activity.get_by_id(id)
assert activity.data["object"]["inReplyTo"] == replied_to.data["object"]["id"]
- assert activity.data["object"]["inReplyToStatusId"] == replied_to.id
+ assert Activity.get_in_reply_to_activity(activity).id == replied_to.id
# Reblog from the third user
conn2 =
diff --git a/test/web/twitter_api/twitter_api_test.exs b/test/web/twitter_api/twitter_api_test.exs
index 6d43bd13a..8781061d4 100644
--- a/test/web/twitter_api/twitter_api_test.exs
+++ b/test/web/twitter_api/twitter_api_test.exs
@@ -105,7 +105,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
get_in(activity.data, ["object", "context"])
assert get_in(reply.data, ["object", "inReplyTo"]) == get_in(activity.data, ["object", "id"])
- assert get_in(reply.data, ["object", "inReplyToStatusId"]) == activity.id
+ assert Activity.get_in_reply_to_activity(reply).id == activity.id
end
test "Follow another user using user_id" do