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