2019-07-10 01:13:23 -04:00
|
|
|
# Pleroma: A lightweight social networking server
|
|
|
|
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2019-04-01 06:17:57 -04:00
|
|
|
defmodule Pleroma.EmojiTest do
|
|
|
|
use ExUnit.Case, async: true
|
|
|
|
alias Pleroma.Emoji
|
|
|
|
|
2019-09-12 20:11:02 -04:00
|
|
|
describe "is_unicode_emoji?/1" do
|
|
|
|
test "tells if a string is an unicode emoji" do
|
|
|
|
refute Emoji.is_unicode_emoji?("X")
|
|
|
|
assert Emoji.is_unicode_emoji?("☂")
|
|
|
|
assert Emoji.is_unicode_emoji?("🥺")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-04-01 06:17:57 -04:00
|
|
|
describe "get_all/0" do
|
|
|
|
setup do
|
|
|
|
emoji_list = Emoji.get_all()
|
|
|
|
{:ok, emoji_list: emoji_list}
|
|
|
|
end
|
2019-04-01 06:54:30 -04:00
|
|
|
|
2019-04-01 06:17:57 -04:00
|
|
|
test "first emoji", %{emoji_list: emoji_list} do
|
|
|
|
[emoji | _others] = emoji_list
|
2019-08-31 03:14:53 -04:00
|
|
|
{code, %Emoji{file: path, tags: tags}} = emoji
|
2019-04-01 06:17:57 -04:00
|
|
|
|
2019-08-31 03:14:53 -04:00
|
|
|
assert tuple_size(emoji) == 2
|
2019-04-01 06:17:57 -04:00
|
|
|
assert is_binary(code)
|
|
|
|
assert is_binary(path)
|
2019-04-18 14:17:52 -04:00
|
|
|
assert is_list(tags)
|
2019-04-01 06:17:57 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
test "random emoji", %{emoji_list: emoji_list} do
|
|
|
|
emoji = Enum.random(emoji_list)
|
2019-08-31 03:14:53 -04:00
|
|
|
{code, %Emoji{file: path, tags: tags}} = emoji
|
2019-04-01 06:17:57 -04:00
|
|
|
|
2019-08-31 03:14:53 -04:00
|
|
|
assert tuple_size(emoji) == 2
|
2019-04-01 06:17:57 -04:00
|
|
|
assert is_binary(code)
|
|
|
|
assert is_binary(path)
|
2019-04-18 14:17:52 -04:00
|
|
|
assert is_list(tags)
|
2019-04-01 06:17:57 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|