Formatter: Test link with local mention
authorAlex Gleason <alex@alexgleason.me>
Tue, 2 Jun 2020 00:51:41 +0000 (19:51 -0500)
committerAlex Gleason <alex@alexgleason.me>
Thu, 16 Jul 2020 21:34:43 +0000 (16:34 -0500)
test/formatter_test.exs

index bef5a2c28813b045cf8ba07cdc9ae84691140d65..ae0d7b37761e57e4d374b8bafe745881a18ee355 100644 (file)
@@ -255,6 +255,16 @@ defmodule Pleroma.FormatterTest do
 
       assert {_text, ^expected_mentions, []} = Formatter.linkify(text)
     end
+
+    test "it parses URL containing local mention" do
+      _user = insert(:user, %{nickname: "lain"})
+
+      text = "https://example.com/@lain"
+
+      expected = ~S(<a href="https://example.com/@lain" rel="ugc">https://example.com/@lain</a>)
+
+      assert {^expected, [], []} = Formatter.linkify(text)
+    end
   end
 
   describe ".parse_tags" do