in spec/frontend/emoji/index_spec.js [936:1061]
emoji: getEmojiMap()[name],
field,
fieldValue,
score,
};
});
expect(searchEmoji(query)).toEqual(expected);
});
it.each([
['searching with a non-existing emoji name', 'asdf', []],
[
'searching by full name',
'atom',
[
{
name: 'atom',
field: 'd',
score: NEUTRAL_INTENT_MULTIPLIER,
},
],
],
[
'searching by full description',
'atom symbol',
[
{
name: 'atom',
field: 'd',
score: NEUTRAL_INTENT_MULTIPLIER,
},
],
],
[
'searching by partial name',
'question',
[
{
name: 'grey_question',
field: 'name',
score: 32,
},
],
],
[
'searching by partial description',
'sym',
[
{
name: 'atom',
field: 'd',
score: 32,
},
],
],
[
'searching with query "heart"',
'heart',
[
{
name: 'heart',
field: 'name',
score: NEUTRAL_INTENT_MULTIPLIER,
},
{
name: 'black_heart',
field: 'd',
score: 64,
},
],
],
[
'searching with query "HEART"',
'HEART',
[
{
name: 'heart',
field: 'name',
score: NEUTRAL_INTENT_MULTIPLIER,
},
{
name: 'black_heart',
field: 'd',
score: 64,
},
],
],
[
'searching with query "star"',
'star',
[
{
name: 'star',
field: 'd',
score: NEUTRAL_INTENT_MULTIPLIER,
},
{
name: 'custard',
field: 'd',
score: 4,
},
],
],
[
'searching for emoji with intentions assigned',
'thumbs',
[
{
name: EMOJI_THUMBS_UP,
field: 'd',
score: 0.5,
},
{
name: EMOJI_THUMBS_DOWN,
field: 'd',
score: 1.5,
},
],
],
])('should return a correct result when %s', (_, query, searchResult) => {
const expected = searchResult.map((item) => {
const { field, score, name } = item;
return {