From: Mark Felder Date: Wed, 3 Feb 2021 22:36:45 +0000 (-0600) Subject: Load an emoji.txt specific to the test env X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=887db076b55764f1cc7757df06f5ff8587de9798;p=akkoma Load an emoji.txt specific to the test env --- diff --git a/config/emoji.txt b/config/emoji.txt index a2c5add2e..52b714ee5 100644 --- a/config/emoji.txt +++ b/config/emoji.txt @@ -1,4 +1,3 @@ firefox, /emoji/Firefox.gif, Gif,Fun blank, /emoji/blank.png, Fun dinosaur, /emoji/dino walking.gif, Gif -external_emoji, https://example.com/emoji.png diff --git a/lib/pleroma/emoji/loader.ex b/lib/pleroma/emoji/loader.ex index 028cf5ea8..cc25dabf9 100644 --- a/lib/pleroma/emoji/loader.ex +++ b/lib/pleroma/emoji/loader.ex @@ -77,10 +77,19 @@ defmodule Pleroma.Emoji.Loader do # it should run even if there are no emoji packs shortcode_globs = Config.get([:emoji, :shortcode_globs], []) + # for testing emoji.txt entries we do not want exposed in normal operation + test_emoji = + if Mix.env() == :test do + load_from_file("test/config/emoji.txt", emoji_groups) + else + [] + end + emojis_txt = (load_from_file("config/emoji.txt", emoji_groups) ++ load_from_file("config/custom_emoji.txt", emoji_groups) ++ - load_from_globs(shortcode_globs, emoji_groups)) + load_from_globs(shortcode_globs, emoji_groups) ++ + test_emoji) |> Enum.reject(fn value -> value == nil end) Enum.map(emojis ++ emojis_txt, &prepare_emoji/1) diff --git a/test/config/emoji.txt b/test/config/emoji.txt new file mode 100644 index 000000000..14dd0c332 --- /dev/null +++ b/test/config/emoji.txt @@ -0,0 +1 @@ +external_emoji, https://example.com/emoji.png