Load an emoji.txt specific to the test env
This commit is contained in:
parent
a7864a9429
commit
887db076b5
3 changed files with 11 additions and 2 deletions
|
@ -1,4 +1,3 @@
|
||||||
firefox, /emoji/Firefox.gif, Gif,Fun
|
firefox, /emoji/Firefox.gif, Gif,Fun
|
||||||
blank, /emoji/blank.png, Fun
|
blank, /emoji/blank.png, Fun
|
||||||
dinosaur, /emoji/dino walking.gif, Gif
|
dinosaur, /emoji/dino walking.gif, Gif
|
||||||
external_emoji, https://example.com/emoji.png
|
|
||||||
|
|
|
@ -77,10 +77,19 @@ def load do
|
||||||
# it should run even if there are no emoji packs
|
# it should run even if there are no emoji packs
|
||||||
shortcode_globs = Config.get([:emoji, :shortcode_globs], [])
|
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 =
|
emojis_txt =
|
||||||
(load_from_file("config/emoji.txt", emoji_groups) ++
|
(load_from_file("config/emoji.txt", emoji_groups) ++
|
||||||
load_from_file("config/custom_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.reject(fn value -> value == nil end)
|
||||||
|
|
||||||
Enum.map(emojis ++ emojis_txt, &prepare_emoji/1)
|
Enum.map(emojis ++ emojis_txt, &prepare_emoji/1)
|
||||||
|
|
1
test/config/emoji.txt
Normal file
1
test/config/emoji.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
external_emoji, https://example.com/emoji.png
|
Loading…
Reference in a new issue