1 defmodule Pleroma.Repo.Migrations.AutolinkerToLinkifyTest do
4 import Pleroma.Tests.Helpers
7 setup do: clear_config(Pleroma.Formatter)
8 setup_all do: require_migration("20200716195806_autolinker_to_linkify")
10 test "change/0 converts auto_linker opts for Pleroma.Formatter", %{migration: migration} do
20 insert(:config, group: :auto_linker, key: :opts, value: autolinker_opts)
24 assert nil == ConfigDB.get_by_params(%{group: :auto_linker, key: :opts})
26 %{value: new_opts} = ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Formatter})
36 Pleroma.Config.put(Pleroma.Formatter, new_opts)
37 assert new_opts == Pleroma.Config.get(Pleroma.Formatter)
39 {text, _mentions, []} =
40 Pleroma.Formatter.linkify(
41 "https://www.businessinsider.com/walmart-will-close-stores-on-thanksgiving-ending-black-friday-tradition-2020-7\n\nOmg will COVID finally end Black Friday???"
45 "<a href=\"https://www.businessinsider.com/walmart-will-close-stores-on-thanksgiving-ending-black-friday-tradition-2020-7\" rel=\"testing\">https://www.businessinsider.com/walmart-will-close-stores-on-thanksgiving-ending-black-friday-tradition-2020-7</a>\n\nOmg will COVID finally end Black Friday???"
48 test "transform_opts/1 returns a list of compatible opts", %{migration: migration} do
66 assert migration.transform_opts(old_opts) == expected_opts