UNPKG

node-emoji

Version:

Friendly emoji lookups and parsing utilities for Node.js

40 lines (34 loc) β€’ 959 B
import { describe, expect, it } from '@jest/globals' import { search } from './search' describe('search', () => { it('returns a single pair when given a one-of emoji name', () => { expect(search('100')).toEqual([{ name: '100', emoji: 'πŸ’―' }]) }) it('returns multiple emojis when given a common substring', () => { expect(search('cartwheel')).toEqual([ { emoji: 'πŸ€Έβ€β™€οΈ', name: 'woman_cartwheeling', }, { emoji: 'πŸ€Έβ€β™‚οΈ', name: 'man_cartwheeling', }, ]) }) it('should match when you include the colon', () => { expect(search(':cartwheel:')).toEqual([ { emoji: 'πŸ€Έβ€β™€οΈ', name: 'woman_cartwheeling', }, { emoji: 'πŸ€Έβ€β™‚οΈ', name: 'man_cartwheeling', }, ]) }) it('returns an empty array when no matching emojis are found', () => { expect(search('notAnEmoji')).toEqual([]) }) })