aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/pleroma/web/metadata/utils_test.exs26
1 files changed, 11 insertions, 15 deletions
diff --git a/test/pleroma/web/metadata/utils_test.exs b/test/pleroma/web/metadata/utils_test.exs
index c5d241886..9d94bf9ca 100644
--- a/test/pleroma/web/metadata/utils_test.exs
+++ b/test/pleroma/web/metadata/utils_test.exs
@@ -7,8 +7,8 @@ defmodule Pleroma.Web.Metadata.UtilsTest do
import Pleroma.Factory
alias Pleroma.Web.Metadata.Utils
- describe "scrub_html_and_truncate" do
- test "it returns text without encode HTML (objects)" do
+ describe "filter_html_and_truncate/1" do
+ test "it returns text without HTML" do
user = insert(:user)
note =
@@ -20,10 +20,10 @@ defmodule Pleroma.Web.Metadata.UtilsTest do
}
})
- assert Utils.scrub_html_and_truncate(note) == "Pleroma's really cool!"
+ assert Utils.filter_html_and_truncate(note) == "Pleroma's really cool!"
end
- test "it replaces <br> with compatible HTML entity (objects)" do
+ test "it replaces <br> with compatible HTML entity (meta tags, push notifications)" do
user = insert(:user)
note =
@@ -35,31 +35,27 @@ defmodule Pleroma.Web.Metadata.UtilsTest do
}
})
- assert Utils.scrub_html_and_truncate(note) ==
+ assert Utils.filter_html_and_truncate(note) ==
"First line&#10;&#13;Second line"
end
+ end
- test "it returns text without encode HTML (binaries)" do
+ describe "scrub_html_and_truncate/2" do
+ test "it returns text without encode HTML" do
assert Utils.scrub_html_and_truncate("Pleroma's really cool!") == "Pleroma's really cool!"
end
- test "it truncates to specified chars (binaries)" do
+ test "it truncates to specified chars" do
assert Utils.scrub_html_and_truncate("Pleroma's really cool!", 10) == "Pleroma..."
end
- # push notifications and link previews should be able to display newlines
- test "it replaces <br> with compatible HTML entity (binaries)" do
- assert Utils.scrub_html_and_truncate("First line<br>Second line") ==
- "First line&#10;&#13;Second line"
- end
-
- test "it strips emojis (binaries)" do
+ test "it strips emojis" do
assert Utils.scrub_html_and_truncate(
"Open the door get on the floor everybody walk the dinosaur :dinosaur:"
) == "Open the door get on the floor everybody walk the dinosaur"
end
- test "it strips HTML tags and other entities (binaries)" do
+ test "it strips HTML tags and other entities" do
assert Utils.scrub_html_and_truncate("<title>my title</title> <p>and a paragraph&#33;</p>") ==
"my title and a paragraph!"
end