emoji-mart-lazyload/spec/emoji-index-spec.js

45 lines
1.2 KiB
JavaScript
Raw Normal View History

2017-11-09 06:41:57 +00:00
import emojiIndex from '../src/utils/emoji-index'
describe('#emojiIndex', () => {
describe('search', function() {
it('should work', () => {
2017-10-07 04:02:02 +00:00
expect(emojiIndex.search('pineapple')).toEqual([
{
id: 'pineapple',
name: 'Pineapple',
colons: ':pineapple:',
emoticons: [],
unified: '1f34d',
skin: null,
native: '🍍',
},
])
})
2017-02-17 14:47:14 +00:00
it('should filter only emojis we care about, exclude pineapple', () => {
2017-11-09 06:41:57 +00:00
let emojisToShowFilter = data => {
data.unified !== '1F34D'
}
2017-10-07 04:02:02 +00:00
expect(
emojiIndex.search('apple', { emojisToShowFilter }).map(obj => obj.id)
).not.toContain('pineapple')
})
it('can include/exclude categories', () => {
2017-10-07 04:02:02 +00:00
expect(emojiIndex.search('flag', { include: ['people'] })).toEqual([])
})
it('can search for thinking_face', () => {
2017-10-07 04:02:02 +00:00
expect(emojiIndex.search('thinking_fac').map(x => x.id)).toEqual([
'thinking_face',
])
})
it('can search for woman-facepalming', () => {
2017-10-07 04:02:02 +00:00
expect(emojiIndex.search('woman-facep').map(x => x.id)).toEqual([
'woman-facepalming',
])
})
2017-10-07 04:02:02 +00:00
})
})