cce4f3607b45233e9e9da50035b70d43724874a6
[anni] / test / pleroma / web / metadata / providers / rel_me_test.exs
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
5 defmodule Pleroma.Web.Metadata.Providers.RelMeTest do
6   use Pleroma.DataCase, async: true
7   import Pleroma.Factory
8   alias Pleroma.Web.Metadata.Providers.RelMe
9
10   test "it renders all links with rel='me' from user bio" do
11     bio =
12       ~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">)
13
14     user = insert(:user, %{bio: bio})
15
16     assert RelMe.build_tags(%{user: user}) == [
17              {:link, [rel: "me", href: "http://some3.com"], []},
18              {:link, [rel: "me", href: "https://another-link.com"], []}
19            ]
20   end
21 end