X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Factivity_pub%2Ftransmogrifier%2Femoji_react_handling_test.exs;h=0fb056b506e038009b3b982eacdee8bcdae9c702;hb=9c672ecbb5d4477cd16d2139a2cb66d3923ac5c8;hp=9f4f6b29665a241b0f02654da8dde989b7484d39;hpb=142bf0957c64f76b9b511200544b1ccbcef5ba16;p=akkoma diff --git a/test/web/activity_pub/transmogrifier/emoji_react_handling_test.exs b/test/web/activity_pub/transmogrifier/emoji_react_handling_test.exs index 9f4f6b296..0fb056b50 100644 --- a/test/web/activity_pub/transmogrifier/emoji_react_handling_test.exs +++ b/test/web/activity_pub/transmogrifier/emoji_react_handling_test.exs @@ -6,6 +6,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.EmojiReactHandlingTest do use Pleroma.DataCase alias Pleroma.Activity + alias Pleroma.Object alias Pleroma.Web.ActivityPub.Transmogrifier alias Pleroma.Web.CommonAPI @@ -14,7 +15,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.EmojiReactHandlingTest do test "it works for incoming emoji reactions" do user = insert(:user) other_user = insert(:user, local: false) - {:ok, activity} = CommonAPI.post(user, %{"status" => "hello"}) + {:ok, activity} = CommonAPI.post(user, %{status: "hello"}) data = File.read!("test/fixtures/emoji-reaction.json") @@ -29,12 +30,17 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.EmojiReactHandlingTest do assert data["id"] == "http://mastodon.example.org/users/admin#reactions/2" assert data["object"] == activity.data["object"] assert data["content"] == "👌" + + object = Object.get_by_ap_id(data["object"]) + + assert object.data["reaction_count"] == 1 + assert match?([["👌", _]], object.data["reactions"]) end test "it reject invalid emoji reactions" do user = insert(:user) other_user = insert(:user, local: false) - {:ok, activity} = CommonAPI.post(user, %{"status" => "hello"}) + {:ok, activity} = CommonAPI.post(user, %{status: "hello"}) data = File.read!("test/fixtures/emoji-reaction-too-long.json") @@ -42,7 +48,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.EmojiReactHandlingTest do |> Map.put("object", activity.data["object"]) |> Map.put("actor", other_user.ap_id) - assert :error = Transmogrifier.handle_incoming(data) + assert {:error, _} = Transmogrifier.handle_incoming(data) data = File.read!("test/fixtures/emoji-reaction-no-emoji.json") @@ -50,6 +56,6 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.EmojiReactHandlingTest do |> Map.put("object", activity.data["object"]) |> Map.put("actor", other_user.ap_id) - assert :error = Transmogrifier.handle_incoming(data) + assert {:error, _} = Transmogrifier.handle_incoming(data) end end