logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma

utils_test.exs (932B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Web.Metadata.UtilsTest do
  5. use Pleroma.DataCase
  6. import Pleroma.Factory
  7. alias Pleroma.Web.Metadata.Utils
  8. describe "scrub_html_and_truncate/1" do
  9. test "it returns text without encode HTML" do
  10. user = insert(:user)
  11. note =
  12. insert(:note, %{
  13. data: %{
  14. "actor" => user.ap_id,
  15. "id" => "https://pleroma.gov/objects/whatever",
  16. "content" => "Pleroma's really cool!"
  17. }
  18. })
  19. assert Utils.scrub_html_and_truncate(note) == "Pleroma's really cool!"
  20. end
  21. end
  22. describe "scrub_html_and_truncate/2" do
  23. test "it returns text without encode HTML" do
  24. assert Utils.scrub_html_and_truncate("Pleroma's really cool!") == "Pleroma's really cool!"
  25. end
  26. end
  27. end