X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=inline;f=test%2Fformatter_test.exs;h=cf8441cf68906e7919ab4f8d5eea8adb6d05f6f2;hb=f9ecb513faec53758371f6d6efd78668997a1d15;hp=087bdbcc2b8a77d08c809595c1040e50fdb81c0f;hpb=6fab5fe7f892b5a9cf4d605b079e544583f0ce73;p=akkoma
diff --git a/test/formatter_test.exs b/test/formatter_test.exs
index 087bdbcc2..cf8441cf6 100644
--- a/test/formatter_test.exs
+++ b/test/formatter_test.exs
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.FormatterTest do
@@ -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"})