aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/formatter_test.exs6
-rw-r--r--test/user_test.exs15
-rw-r--r--test/web/twitter_api/views/user_view_test.exs2
3 files changed, 19 insertions, 4 deletions
diff --git a/test/formatter_test.exs b/test/formatter_test.exs
index 7040f1c27..2e717194b 100644
--- a/test/formatter_test.exs
+++ b/test/formatter_test.exs
@@ -124,7 +124,7 @@ defmodule Pleroma.FormatterTest do
end
describe "add_user_links" do
- test "gives a replacement for user links" do
+ test "gives a replacement for user links, using local nicknames in user links text" do
text = "@gsimg According to @archa_eme_, that is @daggsy. Also hello @archaeme@archae.me"
gsimg = insert(:user, %{nickname: "gsimg"})
@@ -150,7 +150,7 @@ defmodule Pleroma.FormatterTest do
archaeme.id
}' class='u-url mention' href='#{"https://archeme/@archa_eme_"}'>@<span>archa_eme_</span></a></span>, that is @daggsy. Also hello <span class='h-card'><a data-user='#{
archaeme_remote.id
- }' class='u-url mention' href='#{archaeme_remote.ap_id}'>@<span>archaeme@archae.me</span></a></span>"
+ }' class='u-url mention' href='#{archaeme_remote.ap_id}'>@<span>archaeme</span></a></span>"
assert expected_text == Formatter.finalize({subs, text})
end
@@ -168,7 +168,7 @@ defmodule Pleroma.FormatterTest do
Enum.each(subs, fn {uuid, _} -> assert String.contains?(text, uuid) end)
expected_text =
- "<span class='h-card'><a data-user='#{mike.id}' class='u-url mention' href='#{mike.ap_id}'>@<span>mike@osada.macgirvin.com</span></a></span> test"
+ "<span class='h-card'><a data-user='#{mike.id}' class='u-url mention' href='#{mike.ap_id}'>@<span>mike</span></a></span> test"
assert expected_text == Formatter.finalize({subs, text})
end
diff --git a/test/user_test.exs b/test/user_test.exs
index cfccce8d1..21a62483f 100644
--- a/test/user_test.exs
+++ b/test/user_test.exs
@@ -874,4 +874,19 @@ defmodule Pleroma.UserTest do
Pleroma.Config.put([:instance, :account_activation_required], false)
end
end
+
+ describe "parse_bio/2" do
+ test "preserves hosts in user links text" do
+ remote_user = insert(:user, local: false, nickname: "nick@domain.com")
+ user = insert(:user)
+ bio = "A.k.a. @nick@domain.com"
+
+ expected_text =
+ "A.k.a. <span class='h-card'><a data-user='#{remote_user.id}' class='u-url mention' href='#{
+ remote_user.ap_id
+ }'>" <> "@<span>nick@domain.com</span></a></span>"
+
+ assert expected_text == User.parse_bio(bio, user)
+ end
+ end
end
diff --git a/test/web/twitter_api/views/user_view_test.exs b/test/web/twitter_api/views/user_view_test.exs
index b8f1afa76..5f7481eb6 100644
--- a/test/web/twitter_api/views/user_view_test.exs
+++ b/test/web/twitter_api/views/user_view_test.exs
@@ -12,7 +12,7 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
import Pleroma.Factory
setup do
- user = insert(:user, bio: "<span>Here's some html,</span> @mention@domain.com")
+ user = insert(:user, bio: "<span>Here's some html</span>")
[user: user]
end