diff options
author | rinpatch <rinpatch@sdf.org> | 2019-11-14 08:47:10 +0000 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2019-11-14 08:47:10 +0000 |
commit | 6085c71bd17e2b676e0820bf3fd93f81a1902ac3 (patch) | |
tree | a92e6aaa3fd96150d54d04309558c7cd5cae7416 /test/web/common_api/common_api_test.exs | |
parent | f74bb1d0fc123ba8616d81a80dcf5d64b25aa4ed (diff) | |
parent | 7a322713c33e8ef2fdc326f9e35d1fcbe7590c93 (diff) | |
download | pleroma-6085c71bd17e2b676e0820bf3fd93f81a1902ac3.tar.gz pleroma-6085c71bd17e2b676e0820bf3fd93f81a1902ac3.zip |
Merge branch 'reactions' into 'develop'
Emoji Reactions
See merge request pleroma/pleroma!1662
Diffstat (limited to 'test/web/common_api/common_api_test.exs')
-rw-r--r-- | test/web/common_api/common_api_test.exs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs index 8e6fbd7f0..09a3e8dcf 100644 --- a/test/web/common_api/common_api_test.exs +++ b/test/web/common_api/common_api_test.exs @@ -227,6 +227,33 @@ defmodule Pleroma.Web.CommonAPITest do end describe "reactions" do + test "reacting to a status with an emoji" do + user = insert(:user) + other_user = insert(:user) + + {:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"}) + + {:ok, reaction, _} = CommonAPI.react_with_emoji(activity.id, user, "👍") + + assert reaction.data["actor"] == user.ap_id + assert reaction.data["content"] == "👍" + + # TODO: test error case. + end + + test "unreacting to a status with an emoji" do + user = insert(:user) + other_user = insert(:user) + + {:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"}) + {:ok, reaction, _} = CommonAPI.react_with_emoji(activity.id, user, "👍") + + {:ok, unreaction, _} = CommonAPI.unreact_with_emoji(activity.id, user, "👍") + + assert unreaction.data["type"] == "Undo" + assert unreaction.data["object"] == reaction.data["id"] + end + test "repeating a status" do user = insert(:user) other_user = insert(:user) |