commit: e8f22451da18aeba9bcf9f9f6acf93690ccb3cba
parent: 12b6fcdb8c8c65311d1a13976dfe8d027bdcd168
Author: lain <lain@soykaf.club>
Date: Tue, 28 Jan 2020 16:51:29 +0000
Merge branch 'linkify-test-expansion' into 'develop'
Formatter: Add a test for domain / username clashes
See merge request pleroma/pleroma!2151
Diffstat:
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git 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"})