1 defmodule Pleroma.Repo.Migrations.AutolinkerToLinkifyTest do
4 import Pleroma.Tests.Helpers, only: [require_migration: 1]
7 setup_all do: require_migration("20200716195806_autolinker_to_linkify")
9 test "change/0 converts auto_linker opts for Pleroma.Formatter", %{migration: migration} do
19 insert(:config, group: :auto_linker, key: :opts, value: autolinker_opts)
23 assert nil == ConfigDB.get_by_params(%{group: :auto_linker, key: :opts})
25 %{value: new_opts} = ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Formatter})
35 {text, _mentions, []} =
36 Pleroma.Formatter.linkify(
37 "https://www.businessinsider.com/walmart-will-close-stores-on-thanksgiving-ending-black-friday-tradition-2020-7\n\nOmg will COVID finally end Black Friday???"
41 "<a href=\"https://www.businessinsider.com/walmart-will-close-stores-on-thanksgiving-ending-black-friday-tradition-2020-7\" rel=\"ugc\">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???"
44 test "transform_opts/1 returns a list of compatible opts", %{migration: migration} do
62 assert migration.transform_opts(old_opts) == expected_opts