Transmogrifier: Extract user update handling tests.
[akkoma] / test / web / activity_pub / object_validators / types / safe_text_test.exs
index 59ed0a1febbc675744d6f3045b12f78266f44304..d4a574554b03c3389b4f57b5980064174f6a4d11 100644 (file)
@@ -17,6 +17,13 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.Types.SafeTextTest do
     assert {:ok, "hey look xss alert('foo')"} == SafeText.cast(text)
   end
 
+  test "it keeps basic html tags" do
+    text = "hey <a href='http://gensokyo.2hu'>look</a> xss <script>alert('foo')</script>"
+
+    assert {:ok, "hey <a href=\"http://gensokyo.2hu\">look</a> xss alert(&#39;foo&#39;)"} ==
+             SafeText.cast(text)
+  end
+
   test "errors for non-text" do
     assert :error == SafeText.cast(1)
   end