logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma

emoji_test.exs (1143B)


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