X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=test%2Fformatter_test.exs;h=2cf1f3f8e7cf2685bd9585be4637034b41c17d9a;hb=54f6628590414193b9eda347be9def924783b115;hp=b7246252f732c1b7410339f45d5a016cc17a6c80;hpb=4afbef39f49948ddd3b1cd1bbda58ff7e3ac2785;p=akkoma
diff --git a/test/formatter_test.exs b/test/formatter_test.exs
index b7246252f..2cf1f3f8e 100644
--- a/test/formatter_test.exs
+++ b/test/formatter_test.exs
@@ -23,14 +23,21 @@ defmodule Pleroma.FormatterTest do
text = "Hey, check out https://www.youtube.com/watch?v=8Zg1-TufF%20zY?x=1&y=2#blabla."
expected =
- "Hey, check out https://www.youtube.com/watch?v=8Zg1-TufF%20zY?x=1&y=2#blabla."
+ "Hey, check out https://www.youtube.com/watch?v=8Zg1-TufF%20zY?x=1&y=2#blabla."
assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected
text = "https://mastodon.social/@lambadalambda"
expected =
- "https://mastodon.social/@lambadalambda"
+ "https://mastodon.social/@lambadalambda"
+
+ assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected
+
+ text = "https://mastodon.social:4000/@lambadalambda"
+
+ expected =
+ "https://mastodon.social:4000/@lambadalambda"
assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected
@@ -40,21 +47,35 @@ defmodule Pleroma.FormatterTest do
assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected
text = "http://www.cs.vu.nl/~ast/intel/"
- expected = "http://www.cs.vu.nl/~ast/intel/"
+ expected = "http://www.cs.vu.nl/~ast/intel/"
assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected
text = "https://forum.zdoom.org/viewtopic.php?f=44&t=57087"
expected =
- "https://forum.zdoom.org/viewtopic.php?f=44&t=57087"
+ "https://forum.zdoom.org/viewtopic.php?f=44&t=57087"
assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected
text = "https://en.wikipedia.org/wiki/Sophia_(Gnosticism)#Mythos_of_the_soul"
expected =
- "https://en.wikipedia.org/wiki/Sophia_(Gnosticism)#Mythos_of_the_soul"
+ "https://en.wikipedia.org/wiki/Sophia_(Gnosticism)#Mythos_of_the_soul"
+
+ assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected
+
+ text = "https://www.google.co.jp/search?q=Nasim+Aghdam"
+
+ expected =
+ "https://www.google.co.jp/search?q=Nasim+Aghdam"
+
+ assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected
+
+ text = "https://en.wikipedia.org/wiki/Duff's_device"
+
+ expected =
+ "https://en.wikipedia.org/wiki/Duff's_device"
assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected
end
@@ -64,7 +85,13 @@ defmodule Pleroma.FormatterTest do
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)
@@ -76,7 +103,7 @@ defmodule Pleroma.FormatterTest do
expected_text =
"@gsimg According to @archaeme, that is @daggsy. Also hello @archaeme"