Pleroma/test/pleroma/emoji_test.exs

44 lines
1.1 KiB
Elixir
Raw Normal View History

# Pleroma: A lightweight social networking server
2020-03-03 23:44:49 +01:00
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.EmojiTest do
2020-09-24 11:00:39 +02:00
use ExUnit.Case
alias Pleroma.Emoji
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
describe "get_all/0" do
setup do
emoji_list = Emoji.get_all()
{:ok, emoji_list: emoji_list}
end
2019-04-01 12:54:30 +02:00
test "first emoji", %{emoji_list: emoji_list} do
[emoji | _others] = emoji_list
2019-08-31 09:14:53 +02:00
{code, %Emoji{file: path, tags: tags}} = emoji
2019-08-31 09:14:53 +02:00
assert tuple_size(emoji) == 2
assert is_binary(code)
assert is_binary(path)
assert is_list(tags)
end
test "random emoji", %{emoji_list: emoji_list} do
emoji = Enum.random(emoji_list)
2019-08-31 09:14:53 +02:00
{code, %Emoji{file: path, tags: tags}} = emoji
2019-08-31 09:14:53 +02:00
assert tuple_size(emoji) == 2
assert is_binary(code)
assert is_binary(path)
assert is_list(tags)
end
end
end