assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected
+ text = "https://mastodon.social:4000/@lambadalambda"
+
+ expected =
+ "<a href='https://mastodon.social:4000/@lambadalambda'>https://mastodon.social:4000/@lambadalambda</a>"
+
+ assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected
+
text = "@lambadalambda"
expected = "@lambadalambda"
"<a href='https://en.wikipedia.org/wiki/Sophia_(Gnosticism)#Mythos_of_the_soul'>https://en.wikipedia.org/wiki/Sophia_(Gnosticism)#Mythos_of_the_soul</a>"
assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected
+
+ text = "https://www.google.co.jp/search?q=Nasim+Aghdam"
+
+ expected =
+ "<a href='https://www.google.co.jp/search?q=Nasim+Aghdam'>https://www.google.co.jp/search?q=Nasim+Aghdam</a>"
+
+ assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected
end
end
test "gives a replacement for user links" do
text = "@gsimg According to @archaeme, that is @daggsy. Also hello @archaeme@archae.me"
gsimg = insert(:user, %{nickname: "gsimg"})
- archaeme = insert(:user, %{nickname: "archaeme"})
+
+ archaeme =
+ insert(:user, %{
+ nickname: "archaeme",
+ info: %{"source_data" => %{"url" => "https://archeme/@archaeme"}}
+ })
+
archaeme_remote = insert(:user, %{nickname: "archaeme@archae.me"})
mentions = Pleroma.Formatter.parse_mentions(text)
expected_text =
"<span><a href='#{gsimg.ap_id}'>@<span>gsimg</span></a></span> According to <span><a href='#{
- archaeme.ap_id
+ "https://archeme/@archaeme"
}'>@<span>archaeme</span></a></span>, that is @daggsy. Also hello <span><a href='#{
archaeme_remote.ap_id
}'>@<span>archaeme</span></a></span>"