1 defmodule Pleroma.Web.ActivityPub.UtilsTest do
3 alias Pleroma.Web.ActivityPub.Utils
5 describe "determine_explicit_mentions()" do
6 test "works with an object that has mentions" do
11 "href" => "https://example.com/~alyssa",
12 "name" => "Alyssa P. Hacker"
17 assert Utils.determine_explicit_mentions(object) == ["https://example.com/~alyssa"]
20 test "works with an object that does not have mentions" do
23 %{"type" => "Hashtag", "href" => "https://example.com/tag/2hu", "name" => "2hu"}
27 assert Utils.determine_explicit_mentions(object) == []
30 test "works with an object that has mentions and other tags" do
35 "href" => "https://example.com/~alyssa",
36 "name" => "Alyssa P. Hacker"
38 %{"type" => "Hashtag", "href" => "https://example.com/tag/2hu", "name" => "2hu"}
42 assert Utils.determine_explicit_mentions(object) == ["https://example.com/~alyssa"]
45 test "works with an object that has no tags" do
48 assert Utils.determine_explicit_mentions(object) == []
51 test "works with an object that has only IR tags" do
52 object = %{"tag" => ["2hu"]}
54 assert Utils.determine_explicit_mentions(object) == []