diff options
author | Maksim Pechnikov <parallel588@gmail.com> | 2020-01-22 20:20:39 +0300 |
---|---|---|
committer | Maksim Pechnikov <parallel588@gmail.com> | 2020-01-22 20:20:39 +0300 |
commit | cf19bf3c7c82eb64f10cee309484d9591b1a3cae (patch) | |
tree | 77cd904cd7d397eb2ac72561a8cd5dcdd0609044 /test/web/activity_pub | |
parent | e761d76e4fe95a8fadd8eb05d5c55ef5fc4bc8ec (diff) | |
parent | be2777715650d0ac80509f0bd22b4cea8641f9b3 (diff) | |
download | pleroma-cf19bf3c7c82eb64f10cee309484d9591b1a3cae.tar.gz pleroma-cf19bf3c7c82eb64f10cee309484d9591b1a3cae.zip |
Merge branch 'develop' into issue/1383
Diffstat (limited to 'test/web/activity_pub')
-rw-r--r-- | test/web/activity_pub/activity_pub_test.exs | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/test/web/activity_pub/activity_pub_test.exs b/test/web/activity_pub/activity_pub_test.exs index ad6b9810c..ff4604a52 100644 --- a/test/web/activity_pub/activity_pub_test.exs +++ b/test/web/activity_pub/activity_pub_test.exs @@ -867,6 +867,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do test "adds an emoji reaction activity to the db" do user = insert(:user) reactor = insert(:user) + third_user = insert(:user) + fourth_user = insert(:user) {:ok, activity} = CommonAPI.post(user, %{"status" => "YASSSS queen slay"}) assert object = Object.normalize(activity) @@ -881,7 +883,21 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do assert reaction_activity.data["to"] == [User.ap_followers(reactor), activity.data["actor"]] assert reaction_activity.data["context"] == object.data["context"] assert object.data["reaction_count"] == 1 - assert object.data["reactions"]["🔥"] == [reactor.ap_id] + assert object.data["reactions"] == [["🔥", [reactor.ap_id]]] + + {:ok, _reaction_activity, object} = ActivityPub.react_with_emoji(third_user, object, "☕") + + assert object.data["reaction_count"] == 2 + assert object.data["reactions"] == [["🔥", [reactor.ap_id]], ["☕", [third_user.ap_id]]] + + {:ok, _reaction_activity, object} = ActivityPub.react_with_emoji(fourth_user, object, "🔥") + + assert object.data["reaction_count"] == 3 + + assert object.data["reactions"] == [ + ["🔥", [fourth_user.ap_id, reactor.ap_id]], + ["☕", [third_user.ap_id]] + ] end end @@ -919,7 +935,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do object = Object.get_by_ap_id(object.data["id"]) assert object.data["reaction_count"] == 0 - assert object.data["reactions"] == %{} + assert object.data["reactions"] == [] end end |