projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update mogrify package
[akkoma]
/
test
/
web
/
activity_pub
/
transmogrifier
/
emoji_react_handling_test.exs
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 9f4f6b29665a241b0f02654da8dde989b7484d39..0fb056b506e038009b3b982eacdee8bcdae9c702 100644
(file)
--- 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
use Pleroma.DataCase
alias Pleroma.Activity
+ alias Pleroma.Object
alias Pleroma.Web.ActivityPub.Transmogrifier
alias Pleroma.Web.CommonAPI
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)
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")
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"] == "👌"
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)
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")
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)
|> 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")
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)
|> 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
end
end