From 2ad52086b826608ea93e2712d5e52ed555452582 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 11 Jun 2021 13:15:29 -0500 Subject: [PATCH] Fix grouping of tests and validate truncation is working --- test/pleroma/web/metadata/utils_test.exs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/pleroma/web/metadata/utils_test.exs b/test/pleroma/web/metadata/utils_test.exs index 074bd2e2f..8cdfb8ecc 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/1" do - test "it returns text without encode HTML" do + describe "scrub_html_and_truncate" do + test "it returns text without encode HTML (objects)" do user = insert(:user) note = @@ -22,11 +22,13 @@ defmodule Pleroma.Web.Metadata.UtilsTest do assert Utils.scrub_html_and_truncate(note) == "Pleroma's really cool!" end - end - describe "scrub_html_and_truncate/2" do - test "it returns text without encode HTML" do + test "it returns text without encode HTML (binaries)" do assert Utils.scrub_html_and_truncate("Pleroma's really cool!") == "Pleroma's really cool!" end + + test "it truncates to specified chars (binaries)" do + assert Utils.scrub_html_and_truncate("Pleroma's really cool!", 10) == "Pleroma..." + end end end