summaryrefslogtreecommitdiff
path: root/test/formatter_test.exs
diff options
context:
space:
mode:
authorMaksim Pechnikov <parallel588@gmail.com>2020-01-28 20:34:13 +0300
committerMaksim Pechnikov <parallel588@gmail.com>2020-01-28 20:39:20 +0300
commit21a2a054070c26d7be1a0e453e5f40b20fbd59f2 (patch)
treeaf2812719f0485e8d844b1251f0de1be28673395 /test/formatter_test.exs
parentbfc70fdf29c2e1067179165ef686e6abe20896b0 (diff)
parente8f22451da18aeba9bcf9f9f6acf93690ccb3cba (diff)
downloadpleroma-21a2a054070c26d7be1a0e453e5f40b20fbd59f2.tar.gz
pleroma-21a2a054070c26d7be1a0e453e5f40b20fbd59f2.zip
Merge branch 'develop' into issue/1383
Diffstat (limited to 'test/formatter_test.exs')
-rw-r--r--test/formatter_test.exs15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/formatter_test.exs b/test/formatter_test.exs
index 087bdbcc2..37f8bb800 100644
--- a/test/formatter_test.exs
+++ b/test/formatter_test.exs
@@ -119,7 +119,20 @@ defmodule Pleroma.FormatterTest do
end
end
- describe "add_user_links" do
+ describe "Formatter.linkify" do
+ test "correctly finds mentions that contain the domain name" do
+ _user = insert(:user, %{nickname: "lain"})
+ _remote_user = insert(:user, %{nickname: "lain@lain.com", local: false})
+
+ text = "hey @lain@lain.com what's up"
+
+ {_text, mentions, []} = Formatter.linkify(text)
+ [{username, user}] = mentions
+
+ assert username == "@lain@lain.com"
+ assert user.nickname == "lain@lain.com"
+ end
+
test "gives a replacement for user links, using local nicknames in user links text" do
text = "@gsimg According to @archa_eme_, that is @daggsy. Also hello @archaeme@archae.me"
gsimg = insert(:user, %{nickname: "gsimg"})