2019-07-09 23:13:23 -06:00
|
|
|
# Pleroma: A lightweight social networking server
|
2023-01-02 13:38:50 -07:00
|
|
|
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
|
2019-07-09 23:13:23 -06:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2019-04-19 01:50:21 -06:00
|
|
|
defmodule Pleroma.Web.Metadata.Providers.RelMeTest do
|
2020-12-21 04:21:40 -07:00
|
|
|
use Pleroma.DataCase, async: true
|
2019-04-19 01:50:21 -06:00
|
|
|
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 14:29:25 -07: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">)
|
2020-07-16 12:09:48 -06:00
|
|
|
|
2023-02-01 13:24:58 -07:00
|
|
|
fields = [
|
|
|
|
%{
|
|
|
|
"name" => "profile",
|
|
|
|
"value" => ~S(<a rel="me" href="http://profile.com">http://profile.com</a>)
|
|
|
|
},
|
|
|
|
%{
|
|
|
|
"name" => "like",
|
|
|
|
"value" => ~S(<a href="http://cofe.io">http://cofe.io</a>)
|
|
|
|
},
|
|
|
|
%{"name" => "foo", "value" => "bar"}
|
|
|
|
]
|
|
|
|
|
|
|
|
user = insert(:user, %{bio: bio, fields: fields})
|
2019-04-19 01:50:21 -06:00
|
|
|
|
|
|
|
assert RelMe.build_tags(%{user: user}) == [
|
2020-02-10 14:29:25 -07:00
|
|
|
{:link, [rel: "me", href: "http://some3.com"], []},
|
2023-02-01 13:24:58 -07:00
|
|
|
{:link, [rel: "me", href: "http://profile.com"], []},
|
2019-04-19 01:50:21 -06:00
|
|
|
{:link, [rel: "me", href: "https://another-link.com"], []}
|
|
|
|
]
|
|
|
|
end
|
|
|
|
end
|