Test angry face in formatter D:< #1968
authorAlex Gleason <alex@alexgleason.me>
Sat, 18 Jul 2020 20:10:48 +0000 (15:10 -0500)
committerAlex Gleason <alex@alexgleason.me>
Sat, 18 Jul 2020 20:26:23 +0000 (15:26 -0500)
test/formatter_test.exs

index ae0d7b37761e57e4d374b8bafe745881a18ee355..8713ab9c22fbefdb4d761e6f62a610280f99e325 100644 (file)
@@ -265,6 +265,26 @@ defmodule Pleroma.FormatterTest do
 
       assert {^expected, [], []} = Formatter.linkify(text)
     end
+
+    test "it correctly parses angry face D:< with mention" do
+      lain =
+        insert(:user, %{
+          nickname: "lain@lain.com",
+          ap_id: "https://lain.com/users/lain",
+          id: "9qrWmR0cKniB0YU0TA"
+        })
+
+      text = "@lain@lain.com D:<"
+
+      expected_text =
+        ~S(<span class="h-card"><a class="u-url mention" data-user="9qrWmR0cKniB0YU0TA" href="https://lain.com/users/lain" rel="ugc">@<span>lain</span></a></span> D:<)
+
+      expected_mentions = [
+        {"@lain@lain.com", lain}
+      ]
+
+      assert {^expected_text, ^expected_mentions, []} = Formatter.linkify(text)
+    end
   end
 
   describe ".parse_tags" do