aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorIvan Tashkinov <ivantashkinov@gmail.com>2020-12-28 00:08:09 +0300
committerIvan Tashkinov <ivantashkinov@gmail.com>2020-12-28 00:08:09 +0300
commit14fae94c0e4b04123c7af148260d0a4a51042570 (patch)
tree84e4a58577a2887f127778084e9eb2b351193fdb /test
parent4134abef63e1165f5701741c1012e64cb908654c (diff)
downloadpleroma-14fae94c0e4b04123c7af148260d0a4a51042570.tar.gz
[#3213] Made Object.hashtags/1 work with :hashtags assoc. Adjusted tests.
Diffstat (limited to 'test')
-rw-r--r--test/pleroma/activity/ir/topics_test.exs15
1 files changed, 8 insertions, 7 deletions
diff --git a/test/pleroma/activity/ir/topics_test.exs b/test/pleroma/activity/ir/topics_test.exs
index b464822d9..984777bda 100644
--- a/test/pleroma/activity/ir/topics_test.exs
+++ b/test/pleroma/activity/ir/topics_test.exs
@@ -11,6 +11,8 @@ defmodule Pleroma.Activity.Ir.TopicsTest do
require Pleroma.Constants
+ import Mock
+
describe "poll answer" do
test "produce no topics" do
activity = %Activity{object: %Object{data: %{"type" => "Answer"}}}
@@ -77,14 +79,13 @@ defmodule Pleroma.Activity.Ir.TopicsTest do
refute Enum.member?(topics, "public:local:media")
end
- test "converts tags to hash tags", %{activity: %{object: %{data: data} = object} = activity} do
- tagged_data = Map.put(data, "tag", ["foo", "bar"])
- activity = %{activity | object: %{object | data: tagged_data}}
-
- topics = Topics.get_activity_topics(activity)
+ test "converts tags to hash tags", %{activity: activity} do
+ with_mock(Object, [:passthrough], hashtags: fn _ -> ["foo", "bar"] end) do
+ topics = Topics.get_activity_topics(activity)
- assert Enum.member?(topics, "hashtag:foo")
- assert Enum.member?(topics, "hashtag:bar")
+ assert Enum.member?(topics, "hashtag:foo")
+ assert Enum.member?(topics, "hashtag:bar")
+ end
end
test "only converts strings to hash tags", %{