X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=test%2Fpleroma%2Femoji_test.exs;h=027a8132f768fa827f00ae6f41513a8ffc04086f;hb=aacd1c90b7422780ae1eb9030f9fd26d541d4a9c;hp=1dd3c58c6c2a01216c4819234bb343008286fcf1;hpb=131f3219e6b895139c5647cd2050dd22adce7139;p=akkoma
diff --git a/test/pleroma/emoji_test.exs b/test/pleroma/emoji_test.exs
index 1dd3c58c6..027a8132f 100644
--- a/test/pleroma/emoji_test.exs
+++ b/test/pleroma/emoji_test.exs
@@ -1,16 +1,30 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
+# Copyright © 2017-2021 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.EmojiTest do
- use ExUnit.Case
+ 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?("â")
+ 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