Add test
authorrinpatch <rinpatch@sdf.org>
Tue, 18 Dec 2018 19:10:56 +0000 (22:10 +0300)
committerrinpatch <rinpatch@sdf.org>
Tue, 18 Dec 2018 19:10:56 +0000 (22:10 +0300)
test/formatter_test.exs

index bb318b7d5fe9594f50b84aaf57cfe57060fb316b..cfa735795f55b6fac2f0947d0903462aa0305778 100644 (file)
@@ -22,6 +22,18 @@ defmodule Pleroma.FormatterTest do
       assert expected_text ==
                Formatter.add_hashtag_links({[], text}, tags) |> Formatter.finalize()
     end
+
+    test "does not turn html characters to tags" do
+      text = "Fact #3: pleroma does what mastodon't"
+
+      expected_text =
+        "Fact <a data-tag=\"3\" href=\"http://localhost:4001/tag/3\">#3</a>: pleroma does what mastodon't"
+
+      tags = Formatter.parse_tags(text)
+
+      assert expected_text ==
+               Formatter.add_hashtag_links({[], text}, tags) |> Formatter.finalize()
+    end
   end
 
   describe ".add_links" do