test/quesadilla/emoji_test.rb in quesadilla-0.1.0 vs test/quesadilla/emoji_test.rb in quesadilla-0.1.1

- old
+ new

@@ -3,20 +3,21 @@ module Quesadilla class EmojiTest < TestCase def test_that_it_supports_emoji extraction = extract('Something with 👨 beardface') - assert_equal extraction, { + expected = { display_text: 'Something with 👨 beardface', display_html: 'Something with 👨 beardface', entities: [] } + assert_equal expected, extraction end def test_that_it_supports_emoji_with_other_entities extraction = extract('Something #tagged with 👨 beardface') - assert_equal extraction, { + expected = { display_text: 'Something #tagged with 👨 beardface', display_html: 'Something <a href="#hashtag-tagged" class="hashtag">#tagged</a> with 👨 beardface', entities: [ { type: 'hashtag', @@ -26,13 +27,14 @@ indices: [10, 17], display_indices: [10, 17] } ] } + assert_equal expected, extraction extraction = extract('After 💇 #foo 👮 **Yep**') - assert_equal extraction, { + expected = { display_text: 'After 💇 #foo 👮 Yep', display_html: 'After 💇 <a href="#hashtag-foo" class="hashtag">#foo</a> 👮 <strong>Yep</strong>', entities: [ { type: 'hashtag', @@ -49,22 +51,24 @@ indices: [15, 22], display_indices: [15, 18] } ] } + assert_equal expected, extraction end def test_that_it_support_the_colon_syntax extraction = extract('Beardface is :man:') - assert_equal extraction, { + expected = { display_text: 'Beardface is 👨', display_html: 'Beardface is 👨', entities: [] } + assert_equal expected, extraction extraction = extract('Beardface is `not here :man:` :man:') - assert_equal extraction, { + expected = { display_text: 'Beardface is not here :man: 👨', display_html: 'Beardface is <code>not here :man:</code> 👨', entities: [ { type: 'code', @@ -73,13 +77,15 @@ indices: [13, 29], display_indices: [13, 27] } ] } + assert_equal expected, extraction + # TODO: This is broken. Original indicies are messed up if a named emoji is before another entity # extraction = extract('Something #tagged with :man: **beardface**') - # assert_equal extraction, { + # expected = { # display_text: 'Something #tagged with 👨 beardface', # display_html: 'Something <a href="#hashtag-tagged" class="hashtag">#tagged</a> with 👨 <strong>beardface</strong>', # entities: [ # { # type: 'hashtag', @@ -96,8 +102,9 @@ # indices: [29, 42], # display_indices: [30, 39] # } # ] # } + # assert_equal expected, extraction end end end