1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.EmojiTest do
6 use ExUnit.Case, async: true
9 describe "is_unicode_emoji?/1" do
10 test "tells if a string is an unicode emoji" do
11 refute Emoji.is_unicode_emoji?("X")
12 assert Emoji.is_unicode_emoji?("☂")
13 assert Emoji.is_unicode_emoji?("🥺")
17 describe "get_all/0" do
19 emoji_list = Emoji.get_all()
20 {:ok, emoji_list: emoji_list}
23 test "first emoji", %{emoji_list: emoji_list} do
24 [emoji | _others] = emoji_list
25 {code, %Emoji{file: path, tags: tags}} = emoji
27 assert tuple_size(emoji) == 2
28 assert is_binary(code)
29 assert is_binary(path)
33 test "random emoji", %{emoji_list: emoji_list} do
34 emoji = Enum.random(emoji_list)
35 {code, %Emoji{file: path, tags: tags}} = emoji
37 assert tuple_size(emoji) == 2
38 assert is_binary(code)
39 assert is_binary(path)