aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/formatter_test.exs8
-rw-r--r--test/support/factory.ex2
-rw-r--r--test/web/ostatus/activity_representer_test.exs2
3 files changed, 10 insertions, 2 deletions
diff --git a/test/formatter_test.exs b/test/formatter_test.exs
index 4b15f4080..d96f433f9 100644
--- a/test/formatter_test.exs
+++ b/test/formatter_test.exs
@@ -49,6 +49,12 @@ defmodule Pleroma.FormatterTest do
expected_result = "I love <img height='32px' width='32px' alt='moominmamma' title='moominmamma' src='/finmoji/128px/moominmamma-128.png' />"
- assert Formatter.finmojifiy(text) == expected_result
+ assert Formatter.emojify(text) == expected_result
+ end
+
+ test "it returns the emoji used in the text" do
+ text = "I love :moominmamma:"
+
+ assert Formatter.get_emoji(text) == [{"moominmamma", "/finmoji/128px/moominmamma-128.png"}]
end
end
diff --git a/test/support/factory.ex b/test/support/factory.ex
index eca73725d..f499024a2 100644
--- a/test/support/factory.ex
+++ b/test/support/factory.ex
@@ -13,7 +13,7 @@ defmodule Pleroma.Factory do
end
def note_factory do
- text = sequence(:text, &"This is note #{&1}")
+ text = sequence(:text, &"This is :moominmamma: note #{&1}")
user = insert(:user)
data = %{
diff --git a/test/web/ostatus/activity_representer_test.exs b/test/web/ostatus/activity_representer_test.exs
index bcf569395..8a0121b37 100644
--- a/test/web/ostatus/activity_representer_test.exs
+++ b/test/web/ostatus/activity_representer_test.exs
@@ -40,6 +40,7 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenterTest do
<link type="text/html" href="#{note_activity.data["object"]["id"]}" rel="alternate" />
<category term="2hu"/>
<link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"/>
+ <link name="moominmamma" rel="emoji" href="#{Pleroma.Web.Endpoint.static_url}/finmoji/128px/moominmamma-128.png" />
"""
tuple = ActivityRepresenter.to_simple_form(note_activity, user)
@@ -78,6 +79,7 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenterTest do
<category term="2hu"/>
<thr:in-reply-to ref="#{note.data["object"]["id"]}" href="someurl" />
<link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"/>
+ <link name="moominmamma" rel="emoji" href="#{Pleroma.Web.Endpoint.static_url}/finmoji/128px/moominmamma-128.png" />
"""
tuple = ActivityRepresenter.to_simple_form(answer, user)