diff --git a/tests/unit/EmojiCodeTest.js b/tests/unit/EmojiCodeTest.js deleted file mode 100644 index 6513e68f046f..000000000000 --- a/tests/unit/EmojiCodeTest.js +++ /dev/null @@ -1,19 +0,0 @@ -import * as EmojiUtils from '../../src/libs/EmojiUtils'; - -describe('EmojiCode', () => { - it('Test replacing emoji codes with emojis inside a text', () => { - const text = 'Hi :smile:'; - expect(EmojiUtils.replaceEmojis(text)).toBe('Hi 😄'); - }); - - it('Test suggesting emojis when typing emojis prefix after colon', () => { - const text = 'Hi :happy'; - expect(EmojiUtils.suggestEmojis(text)).toEqual([{code: '🙋', name: 'raising_hand'}]); - }); - - it('Test suggest a limited number of matching emojis', () => { - const text = 'Hi :face'; - const limit = 7; - expect(EmojiUtils.suggestEmojis(text, limit).length).toBe(limit); - }); -}); diff --git a/tests/unit/EmojiRegexTest.js b/tests/unit/EmojiTest.js similarity index 79% rename from tests/unit/EmojiRegexTest.js rename to tests/unit/EmojiTest.js index 4bbf3b8fc33a..caecff6b1b05 100644 --- a/tests/unit/EmojiRegexTest.js +++ b/tests/unit/EmojiTest.js @@ -2,7 +2,7 @@ import _ from 'underscore'; import Emoji from '../../assets/emojis'; import * as EmojiUtils from '../../src/libs/EmojiUtils'; -describe('EmojiRegexTest', () => { +describe('EmojiTest', () => { it('matches all the emojis in the list', () => { // Given the set of Emojis available in the application const emojiMatched = _.every(Emoji, (emoji) => { @@ -59,4 +59,25 @@ describe('EmojiRegexTest', () => { expect(EmojiUtils.isSingleEmoji('🇮🇳')).toBe(true); expect(EmojiUtils.isSingleEmoji('🇺🇦️')).toBe(true); }); + + it('replaces emoji codes with emojis inside a text', () => { + const text = 'Hi :smile::wave:'; + expect(EmojiUtils.replaceEmojis(text)).toBe('Hi 😄👋'); + }); + + it('suggests emojis when typing emojis prefix after colon', () => { + const text = 'Hi :happy'; + expect(EmojiUtils.suggestEmojis(text)).toEqual([{code: '🙋', name: 'raising_hand'}]); + }); + + it('suggests a limited number of matching emojis', () => { + const text = 'Hi :face'; + const limit = 3; + expect(EmojiUtils.suggestEmojis(text, limit).length).toBe(limit); + }); + + it('correct suggests emojis accounting for keywords', () => { + const text = ':thumb'; + expect(EmojiUtils.suggestEmojis(text)).toEqual([{code: '👍', name: '+1'}, {code: '👎', name: '-1'}]); + }); });