import emojify from '../emoji'; describe('emoji', () => { describe('.emojify', () => { it('ignores unknown shortcodes', () => { expect(emojify(':foobarbazfake:')).toEqual(':foobarbazfake:'); }); it('ignores shortcodes inside of tags', () => { expect(emojify('

')).toEqual('

'); }); it('works with unclosed tags', () => { expect(emojify('hello>')).toEqual('hello>'); expect(emojify(' { expect(emojify('smile:')).toEqual('smile:'); expect(emojify(':smile')).toEqual(':smile'); }); it('does unicode', () => { expect(emojify('\uD83D\uDC69\u200D\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66')).toEqual( '๐Ÿ‘ฉโ€๐Ÿ‘ฉโ€๐Ÿ‘ฆโ€๐Ÿ‘ฆ'); expect(emojify('๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ง')).toEqual( '๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ง'); expect(emojify('๐Ÿ‘ฉโ€๐Ÿ‘ฉโ€๐Ÿ‘ฆ')).toEqual('๐Ÿ‘ฉโ€๐Ÿ‘ฉโ€๐Ÿ‘ฆ'); expect(emojify('\u2757')).toEqual( 'โ—'); }); it('does multiple unicode', () => { expect(emojify('\u2757 #\uFE0F\u20E3')).toEqual( 'โ— #๏ธโƒฃ'); expect(emojify('\u2757#\uFE0F\u20E3')).toEqual( 'โ—#๏ธโƒฃ'); expect(emojify('\u2757 #\uFE0F\u20E3 \u2757')).toEqual( 'โ— #๏ธโƒฃ โ—'); expect(emojify('foo \u2757 #\uFE0F\u20E3 bar')).toEqual( 'foo โ— #๏ธโƒฃ bar'); }); it('ignores unicode inside of tags', () => { expect(emojify('

')).toEqual('

'); }); it('does multiple emoji properly (issue 5188)', () => { expect(emojify('๐Ÿ‘Œ๐ŸŒˆ๐Ÿ’•')).toEqual('๐Ÿ‘Œ๐ŸŒˆ๐Ÿ’•'); expect(emojify('๐Ÿ‘Œ ๐ŸŒˆ ๐Ÿ’•')).toEqual('๐Ÿ‘Œ ๐ŸŒˆ ๐Ÿ’•'); }); it('does an emoji that has no shortcode', () => { expect(emojify('๐Ÿ•‰๏ธ')).toEqual('๐Ÿ•‰๏ธ'); }); it('does an emoji whose filename is irregular', () => { expect(emojify('โ†™๏ธ')).toEqual('โ†™๏ธ'); }); }); });