Fix grouping of tests and validate truncation is working

This commit is contained in:
Mark Felder 2021-06-11 13:15:29 -05:00
parent 406dadb56b
commit 2ad52086b8

View File

@ -7,8 +7,8 @@ defmodule Pleroma.Web.Metadata.UtilsTest do
import Pleroma.Factory import Pleroma.Factory
alias Pleroma.Web.Metadata.Utils alias Pleroma.Web.Metadata.Utils
describe "scrub_html_and_truncate/1" do describe "scrub_html_and_truncate" do
test "it returns text without encode HTML" do test "it returns text without encode HTML (objects)" do
user = insert(:user) user = insert(:user)
note = note =
@ -22,11 +22,13 @@ defmodule Pleroma.Web.Metadata.UtilsTest do
assert Utils.scrub_html_and_truncate(note) == "Pleroma's really cool!" assert Utils.scrub_html_and_truncate(note) == "Pleroma's really cool!"
end end
end
describe "scrub_html_and_truncate/2" do test "it returns text without encode HTML (binaries)" do
test "it returns text without encode HTML" do
assert Utils.scrub_html_and_truncate("Pleroma's really cool!") == "Pleroma's really cool!" assert Utils.scrub_html_and_truncate("Pleroma's really cool!") == "Pleroma's really cool!"
end end
test "it truncates to specified chars (binaries)" do
assert Utils.scrub_html_and_truncate("Pleroma's really cool!", 10) == "Pleroma..."
end
end end
end end