diff options
author | lain <lain@soykaf.club> | 2020-01-29 11:39:06 +0100 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-01-29 11:39:06 +0100 |
commit | a802e07241e441189f85568ee9ca58508ab6d0d3 (patch) | |
tree | c6c4ace12ac31b53f5db99b5bb0d3e5527734dfd /test/web/pleroma_api | |
parent | f1d5c0f07963c23d264311985c21837b9b03fd5a (diff) | |
download | pleroma-a802e07241e441189f85568ee9ca58508ab6d0d3.tar.gz |
Emoji Reactions: Add `reacted` field to emoji reactions
Diffstat (limited to 'test/web/pleroma_api')
-rw-r--r-- | test/web/pleroma_api/controllers/pleroma_api_controller_test.exs | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/test/web/pleroma_api/controllers/pleroma_api_controller_test.exs b/test/web/pleroma_api/controllers/pleroma_api_controller_test.exs index 3978c2ec5..bc676c99a 100644 --- a/test/web/pleroma_api/controllers/pleroma_api_controller_test.exs +++ b/test/web/pleroma_api/controllers/pleroma_api_controller_test.exs @@ -25,9 +25,14 @@ defmodule Pleroma.Web.PleromaAPI.PleromaAPIControllerTest do |> assign(:user, other_user) |> assign(:token, insert(:oauth_token, user: other_user, scopes: ["write:statuses"])) |> post("/api/v1/pleroma/statuses/#{activity.id}/react_with_emoji", %{"emoji" => "☕"}) + |> json_response(200) - assert %{"id" => id} = json_response(result, 200) + assert %{"id" => id} = result assert to_string(activity.id) == id + + assert result["pleroma"]["emoji_reactions"] == [ + %{"emoji" => "☕", "count" => 1, "reacted" => true} + ] end test "POST /api/v1/pleroma/statuses/:id/unreact_with_emoji", %{conn: conn} do @@ -71,8 +76,20 @@ defmodule Pleroma.Web.PleromaAPI.PleromaAPIControllerTest do |> get("/api/v1/pleroma/statuses/#{activity.id}/emoji_reactions_by") |> json_response(200) - [%{"emoji" => "🎅", "count" => 1, "accounts" => [represented_user]}] = result + [%{"emoji" => "🎅", "count" => 1, "accounts" => [represented_user], "reacted" => false}] = + result + assert represented_user["id"] == other_user.id + + result = + conn + |> assign(:user, other_user) + |> assign(:token, insert(:oauth_token, user: other_user, scopes: ["read:statuses"])) + |> get("/api/v1/pleroma/statuses/#{activity.id}/emoji_reactions_by") + |> json_response(200) + + assert [%{"emoji" => "🎅", "count" => 1, "accounts" => [_represented_user], "reacted" => true}] = + result end test "/api/v1/pleroma/conversations/:id" do |