diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/web/metadata/utils_test.exs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/pleroma/web/metadata/utils_test.exs b/test/pleroma/web/metadata/utils_test.exs index 8cdfb8ecc..b5d3e3566 100644 --- a/test/pleroma/web/metadata/utils_test.exs +++ b/test/pleroma/web/metadata/utils_test.exs @@ -30,5 +30,21 @@ defmodule Pleroma.Web.Metadata.UtilsTest do test "it truncates to specified chars (binaries)" 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 Second line" + end + + test "it strips emojis (binaries)" 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 + assert Utils.scrub_html_and_truncate("<title>my title</title> <p>and a paragraph!</p>") == "my title and a paragraph!" + end end end |