X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=inline;f=test%2Fpleroma%2Femoji_test.exs;h=027a8132f768fa827f00ae6f41513a8ffc04086f;hb=4d341f51e17c36f8c59246d9b7dc5d8793b9fd78;hp=1dd3c58c6c2a01216c4819234bb343008286fcf1;hpb=b738f709532ff18845f5d8cc3888d0bd67f750ab;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