pleroma/test/web/metadata/rel_me_test.exs

22 lines
837 B
Elixir
Raw Normal View History

# Pleroma: A lightweight social networking server
2020-03-03 22:44:49 +00:00
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
2019-04-19 07:50:21 +00:00
defmodule Pleroma.Web.Metadata.Providers.RelMeTest do
use Pleroma.DataCase
import Pleroma.Factory
alias Pleroma.Web.Metadata.Providers.RelMe
test "it renders all links with rel='me' from user bio" do
bio =
2020-02-10 21:29:25 +00:00
~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">)
2019-04-19 07:50:21 +00:00
user = insert(:user, %{bio: bio})
assert RelMe.build_tags(%{user: user}) == [
2020-02-10 21:29:25 +00:00
{:link, [rel: "me", href: "http://some3.com"], []},
2019-04-19 07:50:21 +00:00
{:link, [rel: "me", href: "https://another-link.com"], []}
]
end
end