Pleroma.UserTest: Add tests for rel=me
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Sat, 2 Mar 2019 05:59:09 +0000 (06:59 +0100)
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Sat, 2 Mar 2019 05:59:09 +0000 (06:59 +0100)
test/user_test.exs

index cbe4693fc2cbdac62956356be943bed9a3b59f71..e182a809f9296dbdd6a34725dea841a0a450c1be 100644 (file)
@@ -1039,6 +1039,22 @@ defmodule Pleroma.UserTest do
 
       assert expected_text == User.parse_bio(bio, user)
     end
+
+    test "Adds rel=me on linkbacked urls" do
+      user = insert(:user, ap_id: "http://social.example.org/users/lain")
+
+      bio = "http://example.org/rel_me/null"
+      expected_text = "<a href=\"#{bio}\">#{bio}</a>"
+      assert expected_text == User.parse_bio(bio, user)
+
+      bio = "http://example.org/rel_me/link"
+      expected_text = "<a href=\"#{bio}\">#{bio}</a>"
+      assert expected_text == User.parse_bio(bio, user)
+
+      bio = "http://example.org/rel_me/anchor"
+      expected_text = "<a href=\"#{bio}\">#{bio}</a>"
+      assert expected_text == User.parse_bio(bio, user)
+    end
   end
 
   test "bookmarks" do