You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
44 lines
1.1 KiB
5 years ago
|
# Pleroma: A lightweight social networking server
|
||
5 years ago
|
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
||
5 years ago
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||
|
|
||
6 years ago
|
defmodule Pleroma.EmojiTest do
|
||
4 years ago
|
use ExUnit.Case
|
||
6 years ago
|
alias Pleroma.Emoji
|
||
|
|
||
5 years ago
|
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
|
||
|
|
||
6 years ago
|
describe "get_all/0" do
|
||
|
setup do
|
||
|
emoji_list = Emoji.get_all()
|
||
|
{:ok, emoji_list: emoji_list}
|
||
|
end
|
||
6 years ago
|
|
||
6 years ago
|
test "first emoji", %{emoji_list: emoji_list} do
|
||
|
[emoji | _others] = emoji_list
|
||
5 years ago
|
{code, %Emoji{file: path, tags: tags}} = emoji
|
||
6 years ago
|
|
||
5 years ago
|
assert tuple_size(emoji) == 2
|
||
6 years ago
|
assert is_binary(code)
|
||
|
assert is_binary(path)
|
||
6 years ago
|
assert is_list(tags)
|
||
6 years ago
|
end
|
||
|
|
||
|
test "random emoji", %{emoji_list: emoji_list} do
|
||
|
emoji = Enum.random(emoji_list)
|
||
5 years ago
|
{code, %Emoji{file: path, tags: tags}} = emoji
|
||
6 years ago
|
|
||
5 years ago
|
assert tuple_size(emoji) == 2
|
||
6 years ago
|
assert is_binary(code)
|
||
|
assert is_binary(path)
|
||
6 years ago
|
assert is_list(tags)
|
||
6 years ago
|
end
|
||
|
end
|
||
|
end
|