X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=test%2Fmigrations%2F20200716195806_autolinker_to_linkify_test.exs;h=250d11c61bbc74dc99d749cb88a03717afa7b32b;hb=5a8ea0a5b07c22d567a60af36345483fe880b638;hp=362cf5535c70c77b5c7f3c293bd45f73f386149f;hpb=67389b77af7c6f9ccd18ec385b6ef4fd102e3eb6;p=akkoma
diff --git a/test/migrations/20200716195806_autolinker_to_linkify_test.exs b/test/migrations/20200716195806_autolinker_to_linkify_test.exs
index 362cf5535..250d11c61 100644
--- a/test/migrations/20200716195806_autolinker_to_linkify_test.exs
+++ b/test/migrations/20200716195806_autolinker_to_linkify_test.exs
@@ -1,14 +1,11 @@
defmodule Pleroma.Repo.Migrations.AutolinkerToLinkifyTest do
use Pleroma.DataCase
import Pleroma.Factory
+ import Pleroma.Tests.Helpers
alias Pleroma.ConfigDB
- setup_all do
- [{module, _}] =
- Code.require_file("20200716195806_autolinker_to_linkify.exs", "priv/repo/migrations")
-
- {:ok, %{migration: module}}
- end
+ setup do: clear_config(Pleroma.Formatter)
+ setup_all do: require_migration("20200716195806_autolinker_to_linkify")
test "change/0 converts auto_linker opts for Pleroma.Formatter", %{migration: migration} do
autolinker_opts = [
@@ -17,7 +14,7 @@ defmodule Pleroma.Repo.Migrations.AutolinkerToLinkifyTest do
class: false,
strip_prefix: false,
new_window: false,
- rel: "ugc"
+ rel: "testing"
]
insert(:config, group: :auto_linker, key: :opts, value: autolinker_opts)
@@ -32,17 +29,20 @@ defmodule Pleroma.Repo.Migrations.AutolinkerToLinkifyTest do
class: false,
extra: true,
new_window: false,
- rel: "ugc",
+ rel: "testing",
strip_prefix: false
]
+ Pleroma.Config.put(Pleroma.Formatter, new_opts)
+ assert new_opts == Pleroma.Config.get(Pleroma.Formatter)
+
{text, _mentions, []} =
Pleroma.Formatter.linkify(
"https://www.businessinsider.com/walmart-will-close-stores-on-thanksgiving-ending-black-friday-tradition-2020-7\n\nOmg will COVID finally end Black Friday???"
)
assert text ==
- "https://www.businessinsider.com/walmart-will-close-stores-on-thanksgiving-ending-black-friday-tradition-2020-7\n\nOmg will COVID finally end Black Friday???"
+ "https://www.businessinsider.com/walmart-will-close-stores-on-thanksgiving-ending-black-friday-tradition-2020-7\n\nOmg will COVID finally end Black Friday???"
end
test "transform_opts/1 returns a list of compatible opts", %{migration: migration} do
@@ -52,14 +52,14 @@ defmodule Pleroma.Repo.Migrations.AutolinkerToLinkifyTest do
class: false,
strip_prefix: false,
new_window: false,
- rel: "ugc"
+ rel: "qqq"
]
expected_opts = [
class: false,
extra: true,
new_window: false,
- rel: "ugc",
+ rel: "qqq",
strip_prefix: false
]