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('');
});
});
});