Merge branch 'develop' into feature/polls-2-electric-boogalo
[akkoma] / test / web / rel_me_test.exs
index 94cc0172894e00dddfa150ff4cf8ecce10d51391..5188f4de18cb68d92e0f78f17a80edf1a225b3e8 100644 (file)
@@ -9,6 +9,12 @@ defmodule Pleroma.Web.RelMeTest do
       } ->
         %Tesla.Env{status: 200, body: File.read!("test/fixtures/rel_me_anchor.html")}
 
+      %{
+        method: :get,
+        url: "http://example.com/rel_me/anchor_nofollow"
+      } ->
+        %Tesla.Env{status: 200, body: File.read!("test/fixtures/rel_me_anchor_nofollow.html")}
+
       %{
         method: :get,
         url: "http://example.com/rel_me/link"
@@ -33,21 +39,28 @@ defmodule Pleroma.Web.RelMeTest do
 
     assert Pleroma.Web.RelMe.parse("http://example.com/rel_me/link") == {:ok, hrefs}
     assert Pleroma.Web.RelMe.parse("http://example.com/rel_me/anchor") == {:ok, hrefs}
+    assert Pleroma.Web.RelMe.parse("http://example.com/rel_me/anchor_nofollow") == {:ok, hrefs}
   end
 
   test "maybe_put_rel_me/2" do
     profile_urls = ["https://social.example.org/users/lain"]
-    attr = "rel=\"me\" "
+    attr = "me"
+    fallback = nil
 
     assert Pleroma.Web.RelMe.maybe_put_rel_me("http://example.com/rel_me/null", profile_urls) ==
-             ""
+             fallback
 
     assert Pleroma.Web.RelMe.maybe_put_rel_me("http://example.com/rel_me/error", profile_urls) ==
-             ""
+             fallback
 
     assert Pleroma.Web.RelMe.maybe_put_rel_me("http://example.com/rel_me/anchor", profile_urls) ==
              attr
 
+    assert Pleroma.Web.RelMe.maybe_put_rel_me(
+             "http://example.com/rel_me/anchor_nofollow",
+             profile_urls
+           ) == attr
+
     assert Pleroma.Web.RelMe.maybe_put_rel_me("http://example.com/rel_me/link", profile_urls) ==
              attr
   end