logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git

rel_me_test.exs (1240B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Web.Metadata.Providers.RelMeTest do
  5. use Pleroma.DataCase, async: true
  6. import Pleroma.Factory
  7. alias Pleroma.Web.Metadata.Providers.RelMe
  8. test "it renders all links with rel='me' from user bio" do
  9. bio =
  10. ~s(<a href="https://some-link.com">https://some-link.com</a> <a rel="me" href="https://another-link.com">https://another-link.com</a> <link href="http://some.com"> <link rel="me" href="http://some3.com">)
  11. fields = [
  12. %{
  13. "name" => "profile",
  14. "value" => ~S(<a rel="me" href="http://profile.com">http://profile.com</a>)
  15. },
  16. %{
  17. "name" => "like",
  18. "value" => ~S(<a href="http://cofe.io">http://cofe.io</a>)
  19. },
  20. %{"name" => "foo", "value" => "bar"}
  21. ]
  22. user = insert(:user, %{bio: bio, fields: fields})
  23. assert RelMe.build_tags(%{user: user}) == [
  24. {:link, [rel: "me", href: "http://some3.com"], []},
  25. {:link, [rel: "me", href: "https://another-link.com"], []},
  26. {:link, [rel: "me", href: "http://profile.com"], []}
  27. ]
  28. end
  29. end