2020-01-03 06:21:52 -07:00
|
|
|
# Pleroma: A lightweight social networking server
|
2020-03-01 22:08:45 -07:00
|
|
|
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
2020-01-03 06:21:52 -07:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
defmodule Pleroma.Web.Metadata.UtilsTest do
|
2020-12-21 04:21:40 -07:00
|
|
|
use Pleroma.DataCase, async: true
|
2020-01-03 06:21:52 -07:00
|
|
|
import Pleroma.Factory
|
|
|
|
alias Pleroma.Web.Metadata.Utils
|
|
|
|
|
|
|
|
describe "scrub_html_and_truncate/1" do
|
|
|
|
test "it returns text without encode HTML" do
|
|
|
|
user = insert(:user)
|
|
|
|
|
|
|
|
note =
|
|
|
|
insert(:note, %{
|
|
|
|
data: %{
|
|
|
|
"actor" => user.ap_id,
|
|
|
|
"id" => "https://pleroma.gov/objects/whatever",
|
|
|
|
"content" => "Pleroma's really cool!"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
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
|
|
|
|
assert Utils.scrub_html_and_truncate("Pleroma's really cool!") == "Pleroma's really cool!"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|