mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-27 00:09:35 +00:00
c4439c630f
grep -rl '# Copyright © .* Pleroma' * | xargs sed -i 's;Copyright © .* Pleroma .*;Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>;'
58 lines
1.6 KiB
Elixir
58 lines
1.6 KiB
Elixir
# Pleroma: A lightweight social networking server
|
|
# Copyright © 2017-2021 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")
|
|
refute Emoji.is_unicode_emoji?("ね")
|
|
|
|
# Only accept fully-qualified (RGI) emoji
|
|
# See http://www.unicode.org/reports/tr51/
|
|
refute Emoji.is_unicode_emoji?("❤")
|
|
refute Emoji.is_unicode_emoji?("☂")
|
|
|
|
assert Emoji.is_unicode_emoji?("🥺")
|
|
assert Emoji.is_unicode_emoji?("🤰")
|
|
assert Emoji.is_unicode_emoji?("❤️")
|
|
assert Emoji.is_unicode_emoji?("🏳️⚧️")
|
|
|
|
# Additionally, we accept regional indicators.
|
|
assert Emoji.is_unicode_emoji?("🇵")
|
|
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
|
|
|
|
test "first emoji", %{emoji_list: emoji_list} do
|
|
[emoji | _others] = emoji_list
|
|
{code, %Emoji{file: path, tags: tags}} = emoji
|
|
|
|
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)
|
|
{code, %Emoji{file: path, tags: tags}} = emoji
|
|
|
|
assert tuple_size(emoji) == 2
|
|
assert is_binary(code)
|
|
assert is_binary(path)
|
|
assert is_list(tags)
|
|
end
|
|
end
|
|
end
|