2018-04-30 01:57:52 +00:00
|
|
|
import emojiIndex from '../src/utils/emoji-index/emoji-index'
|
2017-02-02 18:43:26 +00:00
|
|
|
|
|
|
|
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-02 18:43:26 +00:00
|
|
|
|
2017-02-17 14:47:14 +00:00
|
|
|
it('should filter only emojis we care about, exclude pineapple', () => {
|
2018-03-27 18:51:26 +00:00
|
|
|
let emojisToShowFilter = (data) => {
|
2017-11-09 06:41:57 +00:00
|
|
|
data.unified !== '1F34D'
|
|
|
|
}
|
2017-10-07 04:02:02 +00:00
|
|
|
expect(
|
2018-03-27 18:51:26 +00:00
|
|
|
emojiIndex.search('apple', { emojisToShowFilter }).map((obj) => obj.id),
|
2017-10-07 04:02:02 +00:00
|
|
|
).not.toContain('pineapple')
|
|
|
|
})
|
2017-04-18 15:00:20 +00:00
|
|
|
|
|
|
|
it('can include/exclude categories', () => {
|
2017-10-07 04:02:02 +00:00
|
|
|
expect(emojiIndex.search('flag', { include: ['people'] })).toEqual([])
|
2017-04-18 15:00:20 +00:00
|
|
|
})
|
2017-10-06 17:16:34 +00:00
|
|
|
|
|
|
|
it('can search for thinking_face', () => {
|
2018-03-27 18:51:26 +00:00
|
|
|
expect(emojiIndex.search('thinking_fac').map((x) => x.id)).toEqual([
|
2017-10-07 04:02:02 +00:00
|
|
|
'thinking_face',
|
|
|
|
])
|
2017-10-06 17:16:34 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
it('can search for woman-facepalming', () => {
|
2018-03-27 18:51:26 +00:00
|
|
|
expect(emojiIndex.search('woman-facep').map((x) => x.id)).toEqual([
|
2017-10-07 04:02:02 +00:00
|
|
|
'woman-facepalming',
|
|
|
|
])
|
2017-10-06 17:16:34 +00:00
|
|
|
})
|
2017-10-07 04:02:02 +00:00
|
|
|
})
|
|
|
|
})
|