Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into remake-remodel
[akkoma] / test / emoji_test.exs
index a90213d7dd2b8f4967c68b07d76ede0a7fd3820c..7bdf2b6fae9974e77c931ca284ad3fd44a06048e 100644 (file)
@@ -1,7 +1,19 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
 defmodule Pleroma.EmojiTest do
   use ExUnit.Case, async: true
   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()
@@ -10,22 +22,22 @@ defmodule Pleroma.EmojiTest do
 
     test "first emoji", %{emoji_list: emoji_list} do
       [emoji | _others] = emoji_list
-      {code, path, tags} = emoji
+      {code, %Emoji{file: path, tags: tags}} = emoji
 
-      assert tuple_size(emoji) == 3
+      assert tuple_size(emoji) == 2
       assert is_binary(code)
       assert is_binary(path)
-      assert is_binary(tags)
+      assert is_list(tags)
     end
 
     test "random emoji", %{emoji_list: emoji_list} do
       emoji = Enum.random(emoji_list)
-      {code, path, tags} = emoji
+      {code, %Emoji{file: path, tags: tags}} = emoji
 
-      assert tuple_size(emoji) == 3
+      assert tuple_size(emoji) == 2
       assert is_binary(code)
       assert is_binary(path)
-      assert is_binary(tags)
+      assert is_list(tags)
     end
   end
 end