tests: fix up for changed bbcode library output and verify html is properly escaped
authorWilliam Pitcock <nenolod@dereferenced.org>
Fri, 26 Apr 2019 22:38:56 +0000 (22:38 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Fri, 26 Apr 2019 22:45:45 +0000 (22:45 +0000)
test/web/common_api/common_api_utils_test.exs

index df9955d5deb3a953548b34ea0c8d3bf3b4b19d08..ab4c62b35f8e5cded5df8347238ab6e892262d3c 100644 (file)
@@ -128,7 +128,16 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do
       assert output == expected
 
       text = "[b]hello world![/b]\n\nsecond paragraph!"
-      expected = "<strong>hello world!</strong><br><br>second paragraph!"
+      expected = "<strong>hello world!</strong><br>\n<br>\nsecond paragraph!"
+
+      {output, [], []} = Utils.format_input(text, "text/bbcode")
+
+      assert output == expected
+
+      text = "[b]hello world![/b]\n\n<strong>second paragraph!</strong>"
+
+      expected =
+        "<strong>hello world!</strong><br>\n<br>\n&lt;strong&gt;second paragraph!&lt;/strong&gt;"
 
       {output, [], []} = Utils.format_input(text, "text/bbcode")